#变量名是区分大小写的标签:10,Python,random,基础,range,str,print,total From: https://www.cnblogs.com/ltsgsh/p/16783620.html
#导入模块儿
import random
from random import *
print('Hello world!')
print(len('Hello World'))
#str()函数可以传入一个整型值,并求值为它的字符串形式
print('I am '+str(29)+' years old')
#对浮点数进行取整,int()
#range():i 分别被设置为 0、1、2、3、4...变量 i 将递增到(但不包括)传递给 range()函数的整数。
total=0
for num in range(101):
total = total+num
print(total)
#==========================================================================
for i in range(12,16):#参数1-初始值;参数2-上限(不含)
print("i="+str(i))
for i in range(0,10, 2): # 参数1-初始值;参数2-上限(不含);参数3-步长;
print("i=" + str(i))
#==========================================================================
i=0
while i<5:
print ("i = "+ str(i))
i=i+1
#=========================random()=================================================
'''for i in range(5):
print("randint(1,10) = "+ str(random.randint(1,10)))
#from random import *,调用 random模块中的函数时不需要 random.前缀
'''
for i in range(5):
print(" from import test: randint(1,10) = "+ str(randint(1,10)))