[Type B] Python Revision Tour-1 – Chapter 1
Sumita Arora Class 12 Python Solutions is what you might have searched for. This is Unit 1 namely Python Revision tour for class 12. Follow along for computer science with python class 12 sumita arora solutions (PDF). You can print the page as PDF for future reference. Type B Question Solutions are covered.
Table of Contents
1. Fill in the missing lines of code in the following code. The code reads in a limit amount a prices and prints the largest price that is less than the limit. You can assume that all prices and the limit are positive numbers. When a price 0 is entered the program terminates and prints the largest price that is less than the limit.
# Read the limit.
limit = float(input ('enter the limit'))
max_price = 0
#Read the next price
next_price = float(input ("Enter a price or to stop:"))
while next_price > 0 :
<write your code here>
# Read the next price
<Write your code here>
if min_price > 0 :
<Write your code here>
else :
<Write your code here>
# Read the limit.
limit = float(input('enter the limit: '))
max_price = 0
# Read the next price
next_price = float(input("Enter a price or to stop: "))
while next_price > 0:
# Write your code here: Check if the next_price is less than the limit and greater than max_price
if next_price < limit and next_price > max_price:
max_price = next_price
# Read the next price
# Write your code here: Read the next price
next_price = float(input("Enter a price or to stop: "))
if max_price > 0:
# Write your code here: Print the largest price that is less than the limit
print("The largest price that is less than the limit is:", max_price)
else:
# Write your code here: Print a message if no price entered below the limit
print("No price entered below the limit.")