Question 1: (2 marks)
The given file Q1.py already contains statements to input data for three integer variables named a, b, and c. You should write statements to print out the minimum number in three numbers.
Notes:
- Do not edit given statements in the main function
- You can create new functions if you see it is necessary.
Sample input and output:
Input: a3, b=7, c=6
After processing: min = 3
Output for marking:
OUTPUT:
3
Question 2: (3 marks)
The given file Q2.py already contains statements to input data for an integer variable named n. You should write statements to print out the sum of the primes less than n.
(Hint: A prime has only two divisors, 1 and itself. The primes start from 2)
Notes:
- Do not edit given statements in the main function
- You can create new functions if you see it is necessary.
Sample input and output:
Input: n = 7
After processing: 2+3+5 = 10
Output for marking:
OUTPUT:10
Question 3: (2 marks)
The given file Q3.py already contains statements to input data for the list and a variable x. You should write statements to print out the average of elements that are divisible by x in the list.
+ 80%
Zoom
Close