18 questions · untimed

Python first steps: Input and conversion

Pick an option and check it. The explanation shows after each answer. Take as long as you like; nothing is timed and nothing is sent.

18 questions

Question 1 · easy

The user types Puri and presses Enter. What does this program print?

city = input()
print("Welcome to {city}!")

Question 2 · easy

Arjun's program runs marks = input("Marks? ") and he types 250. What does marks hold?

Question 3 · easy

Chai costs ₹12 a cup. The customer types 3 and presses Enter. What does print show? (The question text is not counted.)

cups = int(input("How many cups? "))
print(cups * 12)

Question 4 · easy

After the sums in a split-the-bill program, share holds 83.75. Ravi wants each share to the nearest rupee, 84. Which expression gives 84?

Question 5 · easy

Nisha's program asks for the weight of a parcel in kilograms, and the user may type something like 2.75. Which line reads it correctly as a number?

Question 6 · easy

The teacher adds 5 bonus marks. The user types Nisha, presses Enter, then types 78 and presses Enter. What does this program print?

name = input()
marks = int(input())
print(f"{name} scored {marks + 5}")

Question 7 · medium

Sameer types 12 for the first over and 7 for the second. What does the last line print?

first = input("Runs in over 1? ")
second = input("Runs in over 2? ")
total = first + second
print(f"Total runs: {total}")

Question 8 · medium

Milk costs ₹56 a litre. Priya runs this program and types 1.5. What happens?

litres = int(input("Litres of milk? "))
print(f"Cost: ₹{litres * 56}")

Question 9 · medium

Two friends split ₹13. What does this program print?

share = 13 / 2
print(round(share))

Question 10 · medium

A coaching centre program asks for the number of students and the fee per student, and fees can have paise, like 1250.50. Which pair of lines gives two values ready to calculate with, the moment they are typed?

Question 11 · medium

An auto charges ₹25 to start plus ₹18 for each kilometre. Arjun types 6. What does the last line print?

base = 25
rate = 18
km = int(input("Kilometres? "))
print(f"Auto fare: ₹{base + rate * km}")

Question 12 · medium

Ravi types 870 and 3. He expects Each pays ₹290, but the screen shows Each pays ₹{round(share)}. Which change fixes it?

bill = float(input("Bill: "))
friends = int(input("Friends: "))
share = bill / friends
print("Each pays ₹{round(share)}")

Question 13 · hard

Asha types 180 and 4. Python stops with a TypeError on line 3. Where is the real mistake, and what fixes it?

total_km = input("Kilometres driven? ")
litres = float(input("Petrol used in litres? "))
mileage = total_km / litres
print(f"Mileage: {mileage} km per litre")

Question 14 · hard

Four friends eat at a dhaba. You type 520 for the bill, 25 for the tip percent and 4 for the friends. What does the last line print?

bill = float(input("Bill amount: "))
tip_percent = float(input("Tip percent: "))
friends = int(input("Number of friends: "))
tip = bill * tip_percent / 100
total = bill + tip
share = total / friends
print(f"Each friend pays ₹{round(share)}")

Question 15 · hard

Priya's program should give each person's share of a ₹900 trip plus ₹300 for food, split among 3 people. It runs with no error and prints 1000.0. Which statement is right?

trip = 900
food = 300
people = 3
per_person = trip + food / people
print(per_person)

Question 16 · easy

Meera fills petrol in her scooty. She types 2 and presses Enter. What does this program print?

litres = float(input())
print(f"You filled {litres} litres")

Question 17 · medium

Sameer's film runs for 130 minutes. He types 130 and presses Enter. What does this program print?

mins = int(input())
print(f"{mins // 60} h {mins % 60} min")

Question 18 · hard

Asha types 25 for the price of a notebook, then 3 for how many she buys. The program runs with no error but prints Total: ₹252525. What is wrong, and what fixes it?

price = input()
qty = int(input())
print(f"Total: ₹{price * qty}")

Back to all rounds