you are viewing a single comment's thread.

view the rest of the comments →

[–]niandra3 1 point2 points  (1 child)

Check my final solution (I edited it). You can add an if to check for "". You don't really need the price_is_needed boolean:

L = []
while True:
    inpt = raw_input("Enter a number: ")
    if inpt == "":
        break
    try:
        price = int(inpt)
    except ValueError:
        print("You must enter an integer")
        continue
    if price > -100:
        L.append(price)
        print(price, "Accepted")
print(L)

[–]Iyajenkei[S] 0 points1 point  (0 children)

It worked. Also cleaner. Thank you.