+ 1

While loop

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.

1st Oct 2020, 7:42 PM
SpeedyJabba
SpeedyJabba - avatar
9 Réponses
+ 3
Yes. You can. In which Language? Ex : if you mean like this.. count = 0; while(count<7){ Take input for grade of count count++; }
1st Oct 2020, 7:48 PM
Jayakrishna 🇮🇳
1st Oct 2020, 7:50 PM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 1
im sorry I forgot to clarify Im currently learning Python
1st Oct 2020, 7:52 PM
SpeedyJabba
SpeedyJabba - avatar
+ 1
SpeedyJabba i did it in python
1st Oct 2020, 7:53 PM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 1
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
1st Oct 2020, 7:54 PM
SpeedyJabba
SpeedyJabba - avatar
+ 1
SpeedyJabba ill provide some stuff
1st Oct 2020, 7:55 PM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 1
man thank you so much any help would be awesome!
1st Oct 2020, 7:55 PM
SpeedyJabba
SpeedyJabba - avatar
0
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...
1st Oct 2020, 8:00 PM
Jayakrishna 🇮🇳
0
ok tgank you so much
1st Oct 2020, 8:01 PM
SpeedyJabba
SpeedyJabba - avatar