python while 99乘法表
我写的代码,成死循环了,是缩进有问题吗。#!/usr/bin/python#-*-coding:utf-8-*-i=1while1<=9:j=1whilej<=i:ifj...
我写的代码,成死循环了,是缩进有问题吗。
#!/usr/bin/python
# -*- coding: utf-8 -*-
i = 1
while 1 <= 9:
j = 1
while j <= i:
if j == 1:
print "{0}*{1}={2}".format(j,i,j*i),
else:
print "{0}*{1}={2: <2}".format(j,i,j*i),
j += 1
i += 1
print
i = 1
while 1 <= 9:
j = 1
while j <= i:
if j == 1:
print "{0}*{1}={2}".format(j,i,j*i),
else:
print "{0}*{1}={2: <2}".format(j,i,j*i),
j += 1
i += 1
print 展开
#!/usr/bin/python
# -*- coding: utf-8 -*-
i = 1
while 1 <= 9:
j = 1
while j <= i:
if j == 1:
print "{0}*{1}={2}".format(j,i,j*i),
else:
print "{0}*{1}={2: <2}".format(j,i,j*i),
j += 1
i += 1
i = 1
while 1 <= 9:
j = 1
while j <= i:
if j == 1:
print "{0}*{1}={2}".format(j,i,j*i),
else:
print "{0}*{1}={2: <2}".format(j,i,j*i),
j += 1
i += 1
print 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询