【发布时间】:2020-01-09 08:23:04
【问题描述】:
我正在从控制台或工具使用自动输入之类的平台学习 python,有人提到使用 STDIN 输入,我正在尝试 sys.stdin.readline() 和 sys.stdin.readline().split() 但似乎没有工作,请帮助我。
谢谢
提示是这样的..
Sample Test Cases
**Sample Input**
=======================================
3
1 9
22 31
90 103
========================================
Sample Output
========================================
Difference Not in Range
[22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
Out of Range
========================================
我正在尝试sys.stdin.readline() 和sys.stdin.readline().split()
试图提供手动输入
试过int(input())
代码:
import sys
# Read the variable from STDIN
#begin is the beginning and end is for storing the end value
#taking the user input for the start and end points of the integer
t=int(sys.stdin.readline())
l=[]
while t:
n=1
a=int(sys.stdin.readline().split())
start=int(a[0])
end=int(a[1])
if (end-start<10 and end-start>10 and start<=0,end>=100):
print("Difference Not in Range!")
if start<=0 and end>=100:
print("Out of Range!")
else:
while start<end:
start=start+1
l.append(start)
# Output the variable to STDOUT
STDOUT=print(l)`
【问题讨论】: