https://clonerobbylab.w0w.fr

Workshop WS 2 : average calculations

Improve Number comparator (V2)

a=0
b=0


while (b !=”stop”):
a=(input(“Enter number a please “))
b=(input(“Enter number b please or stop “))

print(“the variable a is “+str(a))
print(“the variable b is “+str(b))

if(a>b):
print(“a bigger than b”)
elif(a==b):
print(“numbers are equals”)
else:
print(“b bigger than a”)

Average calculator V1

english=-5
nepali=-5
maths=-5
score=0

score=(english+nepali+maths)/3
print(“the average is :”+str(score))
if (score<10):
print(“exams failed !”)
elif (score<15):
print(“good”)
else:
print(“excellent !!”)

 

Average calculator V2

english=-5
nepali=-5
maths=-5
score=0

while(True):
while(english<0 or english>20):
english=int(input(“english score “))
while(nepali<0 or nepali>20):
nepali=int(input(“nepali score “))
while(maths<0 or maths>20):
maths=int(input(“maths score “))

score=(english+nepali+maths)/3
print(“the average is :”+str(score))
if (score<10):
print(“exams failed !”)
elif (score<15):
print(“good”)
else:
print(“excellent !!”)
#init values for next loop
english=-5
nepali=-5
maths=-5