5. Write a while loop that will repeatedly request whole numbers from the user.
ID: 3762017 • Letter: 5
Question
5. Write a while loop that will repeatedly request whole numbers from the user. When the user enters 0, a report should be printed saying how many numbers were entered and their sum. The final 0 should not be counted as one of the numbers. Example: Enter a number: 5 Enter a number: -1 Enter a number: 0 There were 2 numbers entered. totaling 4 6. Write a function called honorRoll(). Its only parameter is a list that contains lists consisting of a name followed by a series of grades (integers). All grades will be in the range 0-100. All students will have at least one grade, but not all students will have the same number of grades. Your function should return a list of students whose average grade is above 92.0. 7. Write a function pains() that that takes as parameters two lists of same length x= [x0, x1,x2,. .xn] and y returns the list Hint: use nested for loops. Example:Explanation / Answer
Program for how many numbers entered by user and their sum
sumofnumber = 0.0
print("Program for sum of the given numbers")
count = int(input("How many numbers you want to enter "))
current_countofnumber= 0
while current_countofnumber < count:
current_countofnumber = current_countofnumber + 1
print("Number", current_countofnumber)
number11 = float(input("Enter the number: "))
sumofnumber = sumofnumber + number11
print("The sum was:", sumofnumber)
program for pair the given list
def pairlists(source11):
resultoflist = []
for L1 in range(len(source11)):
for L2 in range(L1+1,len(source11)):
resultoflist.append([source11[L1],source11[L2]])
return resulttoflist
pairingsoflist = pairlists(L1)
print len(pairingsoflist)," pairingsoflist"
for pair in pairingsoflist:
print pair
program for average students grade
def averagestudents(students):
total11 = 0
for subjects in students:
total11 += sum(students[subjects])/len(students[subjects])
return total11/len(students)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.