当前位置: 移动技术网 > IT编程>脚本编程>Python > python練習

python練習

2020年01月16日  | 移动技术网IT编程  | 我要评论

中秋晚会主持人台词,dnf乐乐,windows ce 6.0

打印九九乘法表

1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9
4*1=4 4*2=8 4*3=12 4*4=16
5*1=5 5*2=10 5*3=15 5*4=20 5*5=25
6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36
7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49
8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64
9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81

 

num_h=1
while num_h<=9:#循環h行  
    temp=1
    while temp<=num_h:   #循環l列
        print(str(num_h) + "*" + str(temp)+"="+ str(num_h*temp),end=" ")#打印不換行
        temp =temp+1
        
    print()  #換行
    num_h+=1

***************************************************************************************************

隨機輸入成績判斷等級

score =int(input("score:"))


if score>90:
    print("a")
elif score>80:
    print("b")
elif score>70:
    print("c")
else:
    print("d")

 

 

*************************************************************************************************

打印星星
****
****
****
****
h=int(input("chang:"))#輸入高度

l=int(input("kuan:"))#輸入寬度

num_h=1


while num_h<=l:#循環h行
    num_l=1
    while num_l<=h:   #循環l列
        print("*",end="")#打印不換行
        num_l+=1
    print()  #換行
    num_h+=1

************************************************************************************



打印星星
*
**
***
****

h=int(input("chang:"))#輸入高度
num_h=1
while num_h<=h:#循環h行  
    temp=num_h
    while temp>0:   #循環l列
        print("*",end="")#打印不換行
        temp =temp-1
    print()  #換行
    num_h+=1

**********************************************************************************************

比大小

 

a=input("a:")
b=input("b:")
c=input("c:")
sum=""


if a>b:
    sum=a
    if sum>c:
        print("max is",a)
    else:
        print("max is ",c)
else:
    sum=b
    if sum>c:
        print("max is",b)
    else:
        print("max is ",c)

**************************************************************************************

猜年龄

age_of_princal=56

while true:
    guess_age=int(input(">>:"))
    if guess_age==age_of_princal:
        print("yes,you got it")
        break      #跳出程序
    elif guess_age>age_of_princal:
        print("should try smaller....")
    else:
        print("try bigger....")
print("end")

*************************************************************************************************************

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网