I have a question about Nested loops, primarily converting the lists into an int and then testing to see if it is less than a limit(230) and if it is, it adds one to the limit and one to a count. Here's the code I have so far Whenever I try to work this code: I get an Error message of:
ValueError: invalid literal for int() with base 10: '487 , 440 , 488 , 496 , 55 , 345 , 26 , 446 , 249 , 402 , 311\n'
I think it means that im trying to take the int of that whole string? How could I split it up so that it takes the int of 487, 440, 488, etc
def Nested_Loop():
count = 0
lines = []
limit = 230
listt = open ('numbers.txt', 'r')
value = listt.readlines()
for line in value:
lines.append(line)
for line in lines:
line = int(line)
if line < limit:
limit = limit + 1
count = count + 1
else:
line = limit + 0
count = count + 0
Nested_Loop()
I don't know how to upload the numbers.txt on here, but here is a picture of it.
