Skip to content

Instantly share code, notes, and snippets.

@Echocage
Forked from anonymous/gist:8f83fe94f91f8c63ea7f
Last active August 29, 2015 14:14
Show Gist options
  • Save Echocage/a7c2849bcc2f2a300f25 to your computer and use it in GitHub Desktop.
Save Echocage/a7c2849bcc2f2a300f25 to your computer and use it in GitHub Desktop.
def main():
while True:
how_many_loops = input("How many grades will you be entering? ")
if '.' not in how_many_loops:
for _ in range(int(how_many_loops)):
while True:
score = int(input("Please enter a grade between 0 and 100: "))
if score > 100 or score < 0:
print('Your number is out of range!', end=' ')
continue
break
break # Success
else:
print("You can't enter", how_many_loops, "grades!", end=' ')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment