Online course

PYTHON

TRAINING 1

1. Write a program that asks for the answer to “7 * 5”. If the answer is right let the program answer “Great!”. If the answer is wrong let the program answer “Learn more maths”.


2. Complete the program in order that it answer “too small” if the answer is under 35 and else “Learn more”

TRAINING 2

1/ What does this program return when a=1, b=8 and c=5?

2/ What does this program return in général case ?

Training 1 - solution

1. a=float(input("how much are 5*7 ?"))

if a==35 :

print("Great !")

else:

print("learn more maths !")


2.a=float(input("how much are 5*7 ?"))

if a==35 :

print("Great !")

elif a<35:

print("too small")

else:

print("learn more maths !")

Training 2 - solution

1. It returns 1


2. It returns the smallest number between a, b and c.

RESOURCES

INVOLVED LESSONS