There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different.
For example, we use raw_input()
to take input in Python 2 and input()
in Python 3. Also, in Python 2, the “print” statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses.
Here is a sample line of code that can be executed in Python 3:
x = input() print(x)
Try taking a user input and printing space separated “Hello” and input (without quotes) in the editor below.
Input Format
Read a string input.
Output Format
Print Hello input
to stdout.
Example Input
InterviewBit
Example Output
Hello InterviewBit