r/pythontips • • Sep 26 '24

Syntax Help with code

Im trying to make a code that will have the user enter a random set of integers and add the even numbers but if "9999" is entered it will give the sum of all the given even numbers given. Whats wrong with my code? Here

6 Upvotes

9 comments sorted by

View all comments

Show parent comment

2

u/GrahaamH Sep 26 '24

No problem instead of using float use int it'll make this process a ton easier. Then for elif change it to else or add a condition ie. else: or elif(data != 9999):

1

u/KDLadia Sep 26 '24

saving this for in the morning when i go back to class!

1

u/GrahaamH Sep 26 '24

No problem you can just say :

while data:

And it will run perfectly.