10 月 102020
 
#for循环
for num in range(1,11):
    #range()函数,输出连续的整数序列,起始start,终止stop,不包含终止值
    #将range()函数的值,循环赋值给变量num
    #str()函数将整数转换为字符串,打印字符串,并拼接计算结果
    print(str(num) + '+ 1 =', num + 1)
	print(range(1,11))
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python39/python.exe c:/Users/harveymei/hello.py
1+ 1 = 2
2+ 1 = 3
3+ 1 = 4
4+ 1 = 5
5+ 1 = 6
6+ 1 = 7
7+ 1 = 8
8+ 1 = 9
9+ 1 = 10
10+ 1 = 11
PS C:\Users\harveymei> 

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)