编写一个 Python 程序,使用 for 循环打印前 10 个奇数自然数。
print("====The First 10 Odd Natural Numbers====")
for i in range(1, 11):
print(2 * i - 1)
这个 Python 程序使用 while 循环显示前 10 个奇数自然数。
print("====The First 10 Odd Natural Numbers====")
i = 1
while(i <= 10):
print(2 * i - 1)
i = i + 1
====The First 10 Odd Natural Numbers====
1
3
5
7
9
11
13
15
17
19
原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/258003.html