Name="Donghuangtai"ifname=="Beijing Huan Drink You": Print("Beijing")elifname=="Donghuangtai" : Print("from Chaoyang, Beijing")Else: Print("Big Background")#formatting the output stringn="Good{},{}shi yi ge da shen"; name="Wang Dong Sheng"; title="Zhen Shen";Print(N.format (name,title))#Create a listfruit=["Apple Phone","Meizu","Huawei","Millet"];p=["Daniel","little girl ."," Awesome","艹"]#adding array DataFruit.append ("Huawei")#Array Mergingp.extend (Fruit)#Removing DataP.remove ("艹")#Array Additionsk=fruit+P#Array reversal SortK.reverse (); M=[8,2,5,4,7,6,1]#Array SortingM.sort ();#compare arrays for equalityb=p==m;#Cubic RootN=2**3;Print(n);#Loops#range of ValuesK=range (3,10);#For Loop forIinchRange (20): Print("this number is {}". Format (i)); Print(i);#Traverse ListB=[2,5,6,7,3,1,90,34];b.sort (); forIinchB:Print(i)#with conditional traversal forIinchB:ifI==5: Print("Finally, we wait until 5.") #Break ; #跳出循环 Else: Print(i)#While LoopI=1; whileI<5: I=i+1; Print(i)
The variable and cyclic one of the small white learning python