Loop practice and a review test
Answers are for parents and teachers.
1
Find the sum 20 + 24 + 28 + … + 60.
440
2
What is the starting value of p in the program that finds the product n! of the numbers from 1 to n?
1
3
x is typed. Write a program that prints x // 2 if it is even and 3 * x + 1 if it is odd (22 for 7).
x = int(input()) ⏎ if x % 2 == 0: ⏎ print(x // 2) ⏎ else: ⏎ print(3 * x + 1)
4
Write the result of print("Salom,", "Ali", end="!").
Salom, Ali!