Академический Документы
Профессиональный Документы
Культура Документы
Determine and state the output of the following questions in the space provided below. In case of
any error(s), give details of the error(s) .
(a)
x=32;
y=-28 Output:
if (-x!=-y-4):
print("Inside If Block");
else:
print("Inside Else Block");
(b)
value1='option1'
value2='option2'
value3='option1 '
Output:
if (value1==value2):
print("Inside if block");
elif (value1>value2):
if (value1==value3):
elif (value2>value1):
if (value1==value3):
else:
(c)
value_1 = -140
value_2= 50.93
value_3= 121
if x > 20 :
print ('x > 20')
x=value_1 x=value_2 x=value_3
if x < 80 :
print (x < 80) Output: Output:
elif x > 80: Output:
if x < 100:
print (' x < 100' )
print("Done")
(d)
x = 5
y = 10
z = 10
answer = input("What is the name of your organization? ")
if a = "ITB":
print("Correct!")
print(5 == x + 0.00000000001)
else
print("Incorrect! It is ITB.")
(e)
a=5
b=a
a=4
if(a*b+6/2/3==21): Output:
print("Yes")
else:
print("No")
(f)
print("Welcome!!")
print("A. Banker")
print("B. Govt. Servant")
print("C. Teacher")
user_input = input("What is your occupation? ")
if user_input = A:
money = 1000
else if user_input = B:
money = 700
else if user_input = C:
money = 50
print("Great! You have earned", money, " Rs.")
Output:
(g)
Create a small grade generator program that inputs exam marks for two different subjects and
calculates and tests their average marks for the award of a grade. The examination marks are whole
numbers between 1 and 100. Grades are awarded according to the following criteria:
(h)
Write a program that could be used by a book store to calculate a discount, based on customer status.
Customers are classified either R for Regular or S for Special. Special customers have been members of
the literary club for more than one year. They automatically receive a 50-Rs. discount on all purchases.
The store also holds “value days” several times a year. On value days, all customers receive the 50-Rs.
discount. Special customers do not receive an additional 50 Rs. off during value days, because every day
is a discount for them. Each book at the store costs 1500 Rs.
(i)
A library charges a fine for every book returned late. For first 5 days the fine is 50 Rs. , for 6-10 days fine
is hundered rupees and above 10 days fine is 200 Rupees. If you return the book after 30 days your
membership will be cancelled. Write a program to accept the number of days the member is late to
return the book and display the fine or the appropriate message.