用python语言, 输入m和n两个数字,打印出m行n列的一个程序,具体如下,在线急等啊!!跪求高手科普代码! 5
由用户在屏幕输入两个数字m,n,(》=1,《=9),输出:1x1=12x1=2....1x2=22x2=4...1x3=32x3=6............1xm=m2x...
由用户在屏幕输入两个数字m,n,(》=1,《=9),输出:
1x1=1 2x1=2 ....
1x2=2 2x2=4 ...
1x3=3 2x3=6 ...
.... .....
1xm=m 2xm= 展开
1x1=1 2x1=2 ....
1x2=2 2x2=4 ...
1x3=3 2x3=6 ...
.... .....
1xm=m 2xm= 展开
展开全部
#m为行,n为列的情况
while 1:
try:
m = int(raw_input('input number m:'))
try :
n = int(raw_input('input number n:'))
except :
print 'n must be a number!'
else:
if m < 0 or m > 9:
print 'm must between 0 and 9.'
elif n < 0 or n > 9:
print 'n must between 0 and 9.'
else:
break
except :
print 'm must be a number!'
for x in xrange(1,m+1):
for y in xrange(1,n+1):
print '%s*%s=%s ' % (x,y,x*y),
print '\n',
展开全部
#python3
m,n = (input("please input m,n:")).split(",")
for i in range(m+1):
for i in range(n+1):
print('%d*%d=%d\t' %(i,j,i*j),end="")
print()
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询