so today ive learned about range so i wanted to play with it a little but i got some issue not related to range
now i get an error in the code i attached . i realized its because of the int in the first line (ques)
what i dont know is what i need to convert here in order for me to get the STR in the “else”
i tried a bunch of things but none of them works.
if i remove the int from “”ques”” , i cant do the math after it.
thanks!
ques = int(input("please insert a number > ")) chart = range(0,6) chart2 = range(5,11) if ques == 1 or ques < 5: print (list(chart)) elif ques == 5 or ques > 5: print (list(chart2)) chart3 = input("why not numbers?") else: print (chart3) ques = int(input("please insert a number > ")) ValueError: invalid literal for int() with base 10: 'sef'
submitted by /u/ah_ahaa
[link] [comments]
r/learnpython so today ive learned about range so i wanted to play with it a little but i got some issue not related to range now i get an error in the code i attached . i realized its because of the int in the first line (ques) what i dont know is what i need to convert here in order for me to get the STR in the “else” i tried a bunch of things but none of them works. if i remove the int from “”ques”” , i cant do the math after it. thanks! ques = int(input(“please insert a number > “)) chart = range(0,6) chart2 = range(5,11) if ques == 1 or ques < 5: print (list(chart)) elif ques == 5 or ques > 5: print (list(chart2)) chart3 = input(“why not numbers?”) else: print (chart3) ques = int(input(“please insert a number > “)) ValueError: invalid literal for int() with base 10: ‘sef’ submitted by /u/ah_ahaa [link] [comments]
so today ive learned about range so i wanted to play with it a little but i got some issue not related to range
now i get an error in the code i attached . i realized its because of the int in the first line (ques)
what i dont know is what i need to convert here in order for me to get the STR in the “else”
i tried a bunch of things but none of them works.
if i remove the int from “”ques”” , i cant do the math after it.
thanks!
ques = int(input("please insert a number > ")) chart = range(0,6) chart2 = range(5,11) if ques == 1 or ques < 5: print (list(chart)) elif ques == 5 or ques > 5: print (list(chart2)) chart3 = input("why not numbers?") else: print (chart3) ques = int(input("please insert a number > ")) ValueError: invalid literal for int() with base 10: 'sef'
submitted by /u/ah_ahaa
[link] [comments]