python 九九乘法表

    xiaoxiao2025-01-14  8

    #coding:uft-8 print 'Multiplication_Table' ### Function_1 use 'for in range' ctrl i=0 # Define variable j=0 # Define variable k=0 # Define variable for i in range (1,10): # set 'i' range for j in range (1,i+1): # set 'j' range k=i*j # Multiplication equation print '%d*%d=%d'%(j,i,k), # print the table ### Function_2 use 'while' ctrl m=1 #Define variable n=1 #Define variable t=0 # Define variable while ((m>=1)and(m<=9)) and ((n>=1) and (n<=m)): t=m*n print '%d*%d=%d\t'%(n,m,t), n+=1 while(n>m): n=1 m+=1
    转载请注明原文地址: https://ju.6miu.com/read-1295481.html
    最新回复(0)