[英]How to create python program, multiple of 3 with while loops
ok first sorry if my english is bad好的,如果我的英语不好,首先抱歉
i want to ask how to create python programs multiple of 3 with while loop, like this:我想问一下如何使用 while 循环创建 3 的倍数的 python 程序,如下所示:
i=0
while i < 10:
i += 1
if i == 3:
continue
print(i)
output:
1
2
4
5
6
7
8
9
10
so i want to eliminate the number 3 6 9, can anyone help me?所以我想消除数字 3 6 9,谁能帮我? i newbie:'v thanks.
我是新手:谢谢。
It seems as if you want to print the numbers in reverse order (backwards/upside-down), so here is the snippet of code to achieve that task:似乎您想以相反的顺序(向后/倒置)打印数字,所以这里是实现该任务的代码片段:
i=10
while i > 0:
if i%3 != 0:
print(i)
i-=1
The value of 'i' is the number which it will start counting down from. “i”的值是它将开始倒计时的数字。
i=0
while i < 10:
i += 1
if i % 3 == 0:
continue
print(i)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.