你题目的解答代码如下:
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
if a < b: # 这里是 a < b
i = a
while i <= b:
print(i,end=" ")
i += 1
elif a >= b: # 这里是 a >= b
i = b
while i <= a:
print(i,end=" ")
i += 1
如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!
,
代码缺失,重新贴一下
截图是从小到大排列,你要的是从大到小排列?
从小到大排列
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
if a > b:
i =b
while i < a+1:
print(i,end=" ")
i += 1
elif a < b:
i = a
while i <b+1:
print(i,end=" ")
i += 1
从大到小排列
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
if a > b:
i =a
while i>b-1:
print(i,end=" ")
i -= 1
elif a < b:
i = b
while i >a-1:
print(i,end=" ")
i -= 1