Python - Input from the user
Write the function definition for the function. 'Prompt' to get a 'STRING' input from the user.
Write a script to prompt the question "Enter an STRING:".
Pass the user input in a variable, Say 'x'.
Print the value of 'x' and its type in separate lines.
Sample Input
STDIN ----- One
Sample OutputEnter a STRING: One <class 'str'>
Code:
def Prompt(): # Write your code here print("Enter a STRING:") x = str(input()) print(x) print(type(x))
No comments:
Post a Comment
If you have any doubts, Please let us know.