.Store your favourite subject's name in a variable. Write a program to join that variable to a proper sentence and print it.
Example: "My favourite subject is Computer Science
pls answer why u r not answering
Answers
Storing favourite subject name - Python
What we need to do
We would take a user input string first, to store favourite subject's name in a variable.
We know that the input() function returns a string, string is one of the basis types in Python that store text.
We then join that variable and we print the result.
The Program
subject=input('Enter your favourite subject name:')
print("My favourite subject is, subject")
Sample Run
Enter your favourite subject name: Computer Science
My favourite subject is Computer Science
Answer:
#Done in python...
k=input("What is your favourite subject?")
print("Your favourite subject is ",k)
//JAVA
import java.util.*;
class abc{
public static void main (String ar []){
Scanner sc=new Scanner(System.in);
System.out.println("What's your favourite subject?");
k=sc.nextLine();
System.out.println("Your favourite subject is "+k);
}
}