PFP191_-_PE_-_SU_2023_Hola_Slot_4_284.webp
K

PFP191_-_PE_-_SU_2023_Hola_Slot_4_284.webp

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.
Notes:
- You can create new functions if you see it is necessary
- Do not edit given statements in the main function
- The output value is formatted in two decimal places
Sample input and output:
Input:
Enter the number of elements:5
List: 3 2 5 7 6
Enter x = 3
After processing: (3+6)/2=4.50
Output for marking:
OUTPUT:4.50
Question 4: (3 marks)
The given file Q4.py already contains statements to input a string named str. You should write statements to sum characters are digits in string str.
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: PFP191 PE SU23
After processing: S=1+9+1+2+3=16
Output for marking:
OUTPUT:16
Zoom
+ 80%
Close
Chưa có bình luận nào.

Thông tin

Category
PFP191
Thêm bởi
Kurourushi89
Ngày thêm
Lượt xem
1,051
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PFP191_-_PE_-_SU_2023_Hola_Slot_4_284.webp
File size
47.1 KB
Dimensions
1536px x 793px

Share this media

Back
Bên trên Bottom