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.
Question 1
Find the output of the below python code:
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
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
x = int(input())
print(x)
1
1.5
0
Compilation Error
Question 4
Find the output of the below python code for x=2
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?
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())
There are 6 questions to complete.