• Courses
  • Tutorials
  • Practice
  • Contests
Switch to Dark Mode

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 : Jan 9, 2025
Discuss
Comments

Question 1

Find the output of the below python code:

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


  • A

    Compilation Error 

  • B

    GFGHello

  • C

    GFG Hello 

  • D

    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)
  • A

    10 

  • B

    5

  • C

    0

  • D

    Compilation Error 

Question 3

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

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

    1

  • B

    1.5

  • C

    0

  • D

    Compilation Error 

Question 4

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

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

    2.0

  • B

    2

  • C

    Compilation Error 

  • D

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


  • A

    It will print the age as a string.

  • B

    It will convert the input to a string and print.

  • C

    It will raise a ValueError.

  • D

    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?

  • A

    print(input("Enter message: "))

  • B

    input(print("Enter message: "))

  • C

    print("Enter message: " + input())

  • D

    print("Enter message: ", input())

Tags:

There are 6 questions to complete.

Take a part in the ongoing discussion