There's a repeat for If you get the number of numbers that are less than 10 divided by 3, you make the repeat statement like this.
answer = 0
for i in range(10):
if i%3 == 0:
answer += 1
return answer
But is there a way to find out the number without specifying a variable?
python loops
len(list(filter(lambda i: i%3 == 0, range(10))))
4
len([i for i in range(10) if i % 3 == 0])
4
Wouldn't there be a count? I think there's going to be something like length.
© 2024 OneMinuteCode. All rights reserved.