0
How do I make a list and stop it with "=" sign, because I stop when number is negative, but I want to enter all numbers, positiv
8 Antworten
+ 3
yes, because = is not an integer. in this situation you need to:
take strings
check if that string is a =
if not, change to integer and add to list
+ 2
lista = []
while True:
número = input("Give me another number: ")
if número == '=':
break
lista.append(int(número))
+ 1
Take a look
https://code.sololearn.com/cvu3OnC7TF2o/?ref=app
+ 1
Try this one
https://code.sololearn.com/cOULiL6UqPWR/?ref=app
+ 1
Yeeeaahhh 👏👏👏 💪😎👍 thanks
+ 1
Hii
0
Return error 😭😭😭
0
Uff, error again, it says:
Traceback (most recent call last):
(Adress in pc), line9, in <module>
número = int(input("Give me another number: "))
ValueError: invalid literal for int() with base 10: "="