☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Remainders, decisions and averages

الأسبوع 2 · الدرس ١ «التفكير الحاسوبي وحل المشكلات» (٢): الزوجي والفردي والمتوسط · 3 دروس
Answers are for parents and teachers.
1
Find 22 % 5 and 30 % 5. What do the two remainders say about 22 and 30?
2
A friend writes if num % 2 = 0: in a program. What is wrong, and how do you fix it?
3
The user types 9 in the even-or-odd program. What does the screen show, and what would a last unindented print show?
Python
1num = int(input("Enter a number: "))
2if num % 2 == 0:
3    print("Even number")
4else:
5    print("Odd number")
6print("Done")
4
Marks 40, 70 and 100: write the line for the average and say what it shows. What would a + b + c / 3 show?
5
Give one reason why / gives 60.0 and not 60, and one use of //.