

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The following program repeatedly reads in two numbers and prints their sum. The program continues when the sum is greater than zero and ends otherwise. But it is not well written and contains errors. Rewrite the program with improvements and without errors. ( 12 marks) for i in range(1, 10000 00 ) while True: n1 = intput("1st no.:") n1 = int(input("1st no.: ")) n2 = intput("2nd no.:") n2 = int(input("2nd no.: ")) sum = n1 + n2 sum = n1 + n print("n1 + n2 =", sum) print(n1, "+", n2, "=", sum) if sum > 0 if sum <= 0: continue break else end
Given a = "a", b = "bcd", p = 1 and q = 0, write down the values of the following expressions. If you think that a statement is erroneous, provide the correct statement first, followed by the value. ( 3 marks each) i. a > b and p False ii. a < b < "yz" True iii. a <= b and p <= q False