While loop | Sololearn: Learn to code for FREE!

+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.

10/1/2020 7:42:39 PM

SpeedyJabba

9 Answers

New Answer

+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++; }

+1

https://code.sololearn.com/cPjRwmDjMG43/?ref=app Hmm like this?

+1

im sorry I forgot to clarify Im currently learning Python

+1

SpeedyJabba i did it in python

+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

+1

SpeedyJabba ill provide some stuff

+1

man thank you so much any help would be awesome!

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...

0

ok tgank you so much