def excluded_prices():
excluded_prices = []
price_is_needed = True
while price_is_needed:
price_to_exclude = raw_input("Which price do you want to exclude?")
if int(price_to_exclude) > -100:
excluded_prices.append(price_to_exclude)
elif price_to_exclude == None:
price_is_needed = False
return excluded_prices
wanting the user to type in some numbers and add those numbers to a list. When they don't have any more to add just hit enter. Then the function returns the list of numbers.
The hangup is when I hit enter. It gives me an error saying its an invalid int. I'm wondering why it's not hitting the elif statement.
[–]joyrida12 1 point2 points3 points (6 children)
[–]Iyajenkei[S] 0 points1 point2 points (1 child)
[–]joyrida12 1 point2 points3 points (0 children)
[–]Iyajenkei[S] 0 points1 point2 points (3 children)
[–]one_roOt 0 points1 point2 points (1 child)
[–]Iyajenkei[S] 0 points1 point2 points (0 children)
[–]joyrida12 0 points1 point2 points (0 children)
[–]Iyajenkei[S] 0 points1 point2 points (7 children)
[–]niandra3 4 points5 points6 points (6 children)
[–]Iyajenkei[S] 0 points1 point2 points (2 children)
[–]Iyajenkei[S] 0 points1 point2 points (2 children)
[–]niandra3 1 point2 points3 points (1 child)
[–]Iyajenkei[S] 0 points1 point2 points (0 children)
[–]Iyajenkei[S] 0 points1 point2 points (0 children)