I Have one question Is there any way to stop a while loop after entering inputting a certain amount of times. For example say I Had to submit all the grades for my 7 periods, after inputting 7 of my grades it will move on to whatever chunk of code is next? If anyone can help I would really appreciate it.
10/1/2020 7:42:39 PM
SpeedyJabba9 Answers
New AnswerYes. You can. In which Language? Ex : if you mean like this.. count = 0; while(count<7){ Take input for grade of count count++; }
soo im gonna make the question a little more clear its confusing since we havent gotten that far into learning the python language and our professor is currently teaching us void function and wants us to develop a set of code that will display the average of 5 grades and implement a letter grade as well
Yes. As said, SpeedyJabba Syntax ; while x<7 : grade = int(input()) x =x+1 as a homework, do it yourself first.. Try this info.. In function.. By while loop, take 5 inputs, find sun of inputs, print avg =sum/5 ; For any other doubt in this, you can ask with your try...
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message