Conditional Statements (Dated: Feb 03,2025)
In [1]: a=1000
b=200
if a>b:
print("a is greater than b")
print("a= {} ,b= {}".format(a,b))
print("This line is outside if")
print("This is rest of the program")
a is greater than b
a= 1000 ,b= 200
This line is outside if
This is rest of the program
In [2]: test1=int(input("Enter the first test score"))
test2=int(input("Enter the second test score"))
test3=int(input("Enter the third test score"))
avg=round((test1+test2+test3)/3,2)
print("Average= {}".format(avg))
if avg>=95:
print("Congrtaulation: You got an A Grade")
Enter the first test score98
Enter the second test score98
Enter the third test score97
Average= 97.67
Congrtaulation: You got an A Grade
In [3]: hours=float(input("Enter the number of hours: "))
rate=float(input("Enter the pay rate:"))
if hours>40:
pay=40*rate+(hours-40)*rate*1.5
else:
pay=hours*rate
print("Pay= ${}".format(pay))
Enter the number of hours: 50
Enter the pay rate:10
Pay= $550.0