Python Input Output

It is crucial for interacting with users and processing data effectively. From printing a simple line using print() function to exploring advanced formatting techniques and efficient methods for receiving user input.

Last Updated :
Discuss
Comments

Question 1

Find the output of the below python code:

Python
print("GFG ")
print("Hello")


  • Compilation Error 

  • GFGHello

  • GFG Hello 

  • GFG 

    Hello 

Question 2

Find the output of the below python code, for x=5 and y= 5

Python
x = input()
y = input()
print(x+5)
  • 10 

  • 5

  • 0

  • Compilation Error 

Question 3

Find the output of the below python code, for x=1.5

Python
x = int(input())
print(x)
  • 1

  • 1.5

  • 0

  • Compilation Error 

Question 4

Find the output of the below python code for x=2

Python
x = float(input())
print(x)
  • 2.0

  • 2

  • Compilation Error 

  • None of the above

Question 5

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".

Question 6

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())

Tags:

There are 6 questions to complete.

Take a part in the ongoing discussion