Exercise 2: [10 marks]Write a Python program to find and print the sum of 5positive integergiven by user(save your code asa program named sumOfInputs.py
Answer:
#initialize sum with zero
sum=0
#Ask user input in loop for five times
for i in range(0,5):
#take user input in variable named number
number = input("Enter Number: ")
#add new number in sum
sum+=number
#take avg by dividing sum with total inputs
avg=sum/5.0
#print sum
print("Sum is: ")
print(sum)
#print Average
print ("Average is: ")
print(avg)
OUTPUT:

Upvote the answer(as much needed for me) if it helps else let me know your doubts. Thank you!!
Exercise 2: [10 marks]Write a Python program to find and print the sum of 5positive integergiven...
Exercise 9.2 Write a Python program that collects from the user a single integer. Have the program print “EVEN” if the integer is divisible by 2, and “ODD” if the integer is not divisible by two. [Use the % operator to compute the two’s modulus (remainder of division by two)] Exercise 9.3 Write a Python program that collects from the user two integers. Have the program print “Yes” if the two integers are BOTH greater than 10. Do nothing if...
1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...
Write a PYTHON program that asks the user for the name of the file. The program should write the contents of this input file to an output file. In the output file, each line should be preceded with a line number followed by a colon. The output file will have the same name as the input filename, preceded by “ln” (for linenumbers). Be sure to use Try/except to catch all exceptions. For example, when prompted, if the user specifies “sampleprogram.py”...
#Starting Out With Python, 4th Edition #Chapter 7 #Exercise 6 #in a program, write a function named roll that #accepts an integer argument number_of_throws. The #function should generate and return a sorted #list of number_of_throws random numbers between #1 and 6. The program should prompt the user to #enter a positive integer that is sent to the function, #and then print the returned list. How would you do this?
IN PYTHON Write a program in Python with the use of the for function to print a pyramid of letters of n levels To get the pyramid level, ask the user to capture an integer between 1 and 26 Example: 3 output A A B A A B C B A
C++ code blocks
Exercise#2: Quiz marks Write a program that generates quiz marks at random, between O and 10 inclusive, for a number (less than 50) of Your program should display the marks, class average, and how many students score students decided by the user. above class average. Sample input/output: nter class size: 15 uiz marks: 8 9 9 1 7 5 5 10 1 07 7 5 8 6 e class average is: 5.87 students scored above average
write in python Create a program that will ask the user for a list of integers, all on one line separated by a slash. construct a list named "adj_numbers" which contains the users input numbers after subtracting 2 from each number. then print the resulting list. the input statement and print statement are given to you in the starting code. a sample run of the program is as follows: Enter a list of integers, separated by slashes: 7/3/6/8 resulting list:...
Please use python to write the simple program.
Exercise 2 - Summation Write a program to accept integer inputs until the user inputs a non-integer. Then, the program prints the summation of the inputted numbers. Hint: Use the function input() to get the user input. Use a variable total for calculating the summation. Need to use while loop for the repeated inputs. Use if statement with isdigit() function to check whether the user input is an integer or not. if...
Script 1: Sum of Numbers Write a python program that asks the user to enter a series of single-digit numbers with nothing separating them. The program should display the sum of all the single digit numbers in the string. For example, if the user enters 2514, the method should return 12, which is the sum of 2, 5, 1, and 4.
I want solve it
Question (4): (5 marks) Write a Python program to print all even numbers in given list. Example: Input: list_1 = (2, 4, 5, 7, 13, 44, 45] Output: [2, 4,44]