Python Input Output (original) (raw)
**Find the output of the below python code:
Python `
print("GFG ") print("Hello")
`
**Find the output of the below python code, for x=5 and y= 5
Python `
x = input() y = input() print(x+5)
`
**Find the output of the below python code, for x=1.5
Python `
x = int(input()) print(x)
`
**Find the output of the below python code for x=2
Python `
x = float(input()) print(x)
`
What will happen if a user enters a non-numeric value in the following code?
Python `
age = int(input("Enter your age: ")) print("You are", age, "years old")
`
- It will print the age as a string.
- It will convert the input to a string and print.
- It will raise a ValueError.
- It will print "You are 0 years old".
Which of the following statements is used to display a user-inputted message followed by a new line?
- print(input("Enter message: "))
- input(print("Enter message: "))
- print("Enter message: " + input())
- print("Enter message: ", input())
There are 6 questions to complete.
Take a part in the ongoing discussion