取两个整数输入,即x = 10和y = 50,并以10,20 20,30,30,40和40,50的格式打印

时间:2014-01-29 10:47:06

标签: python-2.7

x = int(input("Enter the start Number:"))
y = int(input("Enter the end number:"))

while(start < end):

    start = start + 10
    new = start + 10
    print start, new

请有人帮助我。 我希望输出像

10,20
20,30
30,40
40,50

2 个答案:

答案 0 :(得分:1)

你想要这样的东西吗?

start = int(input("Enter the start Number:"))
end = int(input("Enter the end number:"))

while(start < end):
    print start, start + 10
    start = start + 10

答案 1 :(得分:1)

如果你已经知道要循环多少次,那么使用for循环和range要简洁得多:

start = int(input("Enter the start Number:"))
end = int(input("Enter the end number:"))

for n in range(start, end, 10):
    print(n, n + 10)