You can use input:

# the first line contains integer
integer1 = int(input())

# the second line contains the space separated list of integers
int_lst = list(map(int, input().split()))

# third line contains another integer.
integer2 = int(input())
list of lists for 10 lines:
lst = [list(map(int, input().split())) for _ in range(10)]
Answer from mozway on Stack Overflow
🌐
HackerRank
hackerrank.com › challenges › python-raw-input › tutorial
Reading Raw Input | HackerRank
When a line of input is entered, that string of text is saved to the variable. Similarly, you can read a line of input from stdin without passing any string arguments to raw_input or input.
Discussions

python - StdIn for Reading Inputs Hacker Rank Challenges - Stack Overflow
One thing that has frustrated me the most from the Hackerrank challenges is the part of reading inputs for the functions through stdin. Hackerrank inputs generally have a \n delimiter, which is pr... More on stackoverflow.com
🌐 stackoverflow.com
python - Python3: Using input() with stdin, like in hackerrank - Stack Overflow
I have an input file ("abc.in") which I will like to read each line as input(), exactly like how it works on hackerrank and other online coding platforms. I have seen solutions replicating the same More on stackoverflow.com
🌐 stackoverflow.com
Day 1: Data Types Discussions | Tutorials | HackerRank
For Python programmers: The key to solve this problem is undesrtanding how to read "stdin". Take a look at "Standard File Objects" section on this guide: https://en.wikibooks.org/wiki/Python_Programming/Input_and_Output More on hackerrank.com
🌐 hackerrank.com
Hackerrank how to read input and print output?
For Python, that means raw_input() (Python 2) and input() (Python 3) and print() (at least for the ones I've done so far, just started today.) More on reddit.com
🌐 r/learnpython
4
1
June 20, 2015
🌐
Reddit
reddit.com › r/learnpython › hackerrank how to read input and print output?
r/learnpython on Reddit: Hackerrank how to read input and print output?
June 20, 2015 -

I am trying to do some challenges on Hackerrank and it says read input from STDIN and print output to STDOUT. What exactly does this mean and how do I read the input and print the output? I vaguely remember STDIN and STDOUT being used in C++ or something, but I don't know how to use them in Python.

🌐
Quora
quora.com › What-does-HackerRank-mean-by-Read-input-from-STDIN-Print-output-to-STDOUT-How-do-I-read-and-write-to-it-in-Python-2-3
What does HackerRank mean by, 'Read input from STDIN. Print output to STDOUT'? How do I read and write to it in Python 2/3? - Quora
Answer (1 of 3): Stdin refers standard input Stdout refers standard output In our case standard input and output are keyboard and monitor respectively So consider you're solving the problem on your IDE and you compile/interpret your code then copy the input data from the sample input provided ...
🌐
YouTube
youtube.com › watch
Reading inputs in HackerRank using python - YouTube
How to read inputs from HackerRank STDIN using python
Published   March 5, 2021
🌐
YouTube
youtube.com › watch
How to read the input in coding console questions? | STDIN, STDOUT | HackerRank| Session With Sumit - YouTube
In the video, we will try to understand, how we can read the input and write back the output for various #codingconsole based question. We will also try to u...
Published   August 12, 2020
Find elsewhere
🌐
YouTube
youtube.com › watch
read input from stdin print output to stdout python hackerrank - YouTube
Download this code from https://codegive.com Title: Python HackerRank Tutorial: Reading Input from stdin and Printing Output to stdoutIntroduction:HackerRank...
Published   December 26, 2023
🌐
Quora
quora.com › How-do-I-make-my-HackerRank-Python-solutions-STDIN-STDOUT-compliant
How to make my HackerRank Python solutions STDIN/STDOUT compliant - Quora
Read all input first (when problem is batch-style) Use sys.stdin.read() to get the entire input as a single string when input size is modest and format is line-oriented or whitespace-separated.
🌐
CodingBroz
codingbroz.com › home › hackerrank › input() in python | hackerrank solution
Input() in Python | HackerRank Solution - CodingBroz
June 21, 2021 - In Python 2, the expression input() is equivalent to eval(raw _input(prompt)). ... >>> input() 1+2 3 >>> company = 'HackerRank' >>> website = 'www.hackerrank.com' >>> input() 'The company name: '+company+' and website: '+website 'The company ...
🌐
GitHub
gist.github.com › neonbadger › 9033173b04407462621e
Hackerrank stdin & stdout for python · GitHub
August 9, 2017 - Hackerrank stdin & stdout for python · Raw · stdin.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters · Show hidden characters · Copy link · This doesn't work as presented · def main(): t = int(raw_input()) for _ in xrange(t): a, b = map(int, raw_input().strip().split(' ')) print(a,b) main() Traceback (most recent call last): File "solution.py", line 8, in main() File "solution.py", line 5, in main a, b = map(int, raw_input().strip().split(' ')) ValueError: need more than 1 value to unpack ·
🌐
HackerRank
hackerrank.com › challenges › python-raw-input › forum
Reading Raw Input Discussions | | HackerRank
October 30, 2016 - We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies. ... personal opin: some times there is even bug in the input functions.. why it has to use stdin and stdout, also not very flexible for testing the code.
🌐
GeeksforGeeks
geeksforgeeks.org › python › take-input-from-stdin-in-python
Take input from stdin in Python - GeeksforGeeks
July 12, 2025 - import sys for line in sys.stdin: if 'q' == line.rstrip(): break print(f'Input : {line}') print("Exit") ... The input() can be used to take input from the user while executing the program and also in the middle of the execution.
🌐
Blogger
allhackerranksolutions.blogspot.com › 2016 › 07 › reading-raw-input-hacker-rank-solution.html
Reading Raw Input -- Hacker Rank Solution - Hacker Rank Solutions
July 21, 2016 - Task Read a line of input from ... . ... Print the contents of to stdout. ... In Python 2, raw_input() reads a line from input, converts it to a string (stripping a trailing newline), and returns the string....
🌐
Quora
quora.com › The-HackerRank-site-says-Read-input-from-STDIN-Print-output-to-STDOUT-How-do-I-give-the-output-and-take-the-input-in-Python
The HackerRank site says 'Read input from STDIN. Print output to STDOUT.' How do I give the output and take the input in Python? - Quora
Answer (1 of 2): Use the sys module: sys.stdin is an already readable open file that is the same as STDIN, and being a file you can read(), readline() or even iterate over it like any other file. sys.stdout is an already writable open file that ...
🌐
Reddit
reddit.com › r/learnpython › how do i read input from hackerrank?
r/learnpython on Reddit: How do I read input from HackerRank?
March 2, 2018 - I'm trying to work through some practice problems on HackerRank, but I don't understand how to even read the input. Here's an example of what I'm…
🌐
HackerRank
hackerrank.com › challenges › 30-data-types › forum › comments › 133668
Day 1: Data Types Discussions | Tutorials | HackerRank
For Python programmers: The key to solve this problem is undesrtanding how to read "stdin". Take a look at "Standard File Objects" section on this guide: https://en.wikibooks.org/wiki/Python_Programming/Input_and_Output