Booleans to numbers
""" Write a code that takes two whole number as input and lists all the even numbers between the interval of the two inputs.""" num1=int(input()) num2=int(input()) for i in range(num1, num2): even = i %2 == 0 print(even) I'd like to ask what lesson has the clue to list the actual numbers, not just true/false? Thank you!
1/27/2022 8:50:24 AMKajtár László
4 AnswersNew Answer
#Use 'if' condition, num1=int(input()) num2=int(input()) for i in range(num1, num2): if i %2 == 0: print(i) // Kajtár László edit]: you can do one more thing,in this line write 2 after num2 like this: for i in range(num1, num2, 2): it will work too!
I see "Booleans to numbers" in title. In Description I see a question about filtering even numbers within range. Am I the only who got lost trying to relate the title and the Description???
When I run the code it outputs True False True False... according to if it's even or odd, not the numbers themselves. Sorry if it's misleading! :/
Epic! Thank you! Shame I didn't tought about that...