Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14126

Adding multiple conditions in a while loop in python

$
0
0

i'm having problems adding these 3 conditions in a while loop, where is the error?

n = eval(input("Number: "))i = 0while (i % 3 == 0) and (i % 5 == 0) and (i < n):    print(i, end=" ")    i = i + 1

I want it to print the numbers divisible by 3 and 5 as long as i < n.If i type in 100 it gives back 0 right now.


Viewing all articles
Browse latest Browse all 14126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>