Back to Learning Hub

Day 7: Python User Input, Type Conversion

15 questions • Select the best answer for each question

Question 1

What does the input() function do?

Question 2

What is the data type of input received using input()?

Question 3

What will be the output? age = input("Enter age: ") print(type(age))

Question 4

Which line correctly converts user input to an integer?

Question 5

What will happen? num1 = input("Enter number: ") num2 = input("Enter number: ") print(num1 + num2) User enters: 5 and 3

Question 6

How do you fix the previous code to get 8?

Question 7

What will this print? price = float(input("Enter price: ")) qty = int(input("Enter quantity: ")) print(price * qty)

Question 8

Which is the correct way to print user data using f-strings?

Question 9

What will this code do? password = input("Enter password: ") if len(password) >= 8: print("Valid password") else: print("Invalid password")

Question 10

Why is validation usually written inside a function?

Question 11

Which function correctly validates password length? def is_valid(password): return len(password) >= 8

Question 12

What does this function return? def check_age(age): if age >= 18: return "Adult" return "Minor" If age = 20

Question 13

Which creates a multi-line formatted output?

Question 14

Which is best for a Client Registration Form?

Question 15

Which statement is TRUE?