Solving without the range function

I forgot about the range function. I still managed to solve it; but now, seeing the one-line solution above, I realize I really overthought this one:

#Write your function here
def every_three_nums(start):
# creates an empty list
  new_lst = []
# returns empty list if start is more than 100
  if start > 100:
    return new_lst
# otherwise new_lst starts at 'start'
  else:
    new_lst = [start]
# as long as the last number of the list is no more than 97...
    while new_lst[-1] <=97:
# ...the function adds a number equal to the length of the list times 3 plus 'start'
      new_lst.append(len(new_lst)*3 + start)
    return new_lst
1 Like

Hello Jonathan, I checked your solution, it works when the start is 91, but if you try 10 for example, the output start from 1. I changed it to

creates an empty list

new_lst =

returns empty list if start is more than 100

if start > 100:
return new_lst
else:
new_lst = [start]
while new_lst[-1] <=97:

…the function adds a number equal to the length of the list times 3 plus ‘start’

  #new_lst.append(len(new_lst)*3 + start)
  new_lst.append(new_lst[-1] + 3)
return new_lst

#Uncomment the line below when your function is done
print(every_three_nums(10))