Answered step by step
Verified Expert Solution
Question
1 Approved Answer
sum=1+1/2+1/3+1/4++1 The program includes two functions in parts a) and b) below: [11 marks] (a) The function main (): [5 Marks] accept no input parameter
sum=1+1/2+1/3+1/4++1 The program includes two functions in parts a) and b) below: [11 marks] (a) The function main (): [5 Marks] accept no input parameter and without return value ask user to input an end value (e.g. n=100) and store it in a variable named: n display the input end value on screen properly call the sumH () with the input data as argument Call the main () function for starting execution (b) The function sumH (): [6 Marks] accept one parameter (newN), and without return value calculate the sum (use range () to manipulate the accepted parameter of newN in the for loop) and store it in a variable named: sum finally display the sum on screen as the sample output below (c) Write a Python program to create a list with 5 integers, find and display the average value by using built-in functions sum () and len (). .[5 Marks] - Create a list named myLi ist and initialize it with 5 integers below - 11,22,33,44, ab Make sure use Your Student ID! - Remark: for integer ab, use the last 2 digits of vour student ID. E.g. Use 55 for ab above, if your student ID is 55 Display the list values on a single line by using for loop Determine and display the average (in integer type) of the list by using built-in sum () and len ()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started