Input throws error

Respected Sir, i give the value to the input of the following code written in input.py, but it throws error
Code:
#!/bin/bash
name = input("What's your name? ")

        print("Nice to meet you, " + name)

Error:

It doesn’t throw error only if I give input in double quotes.
Would you please tell me why is that so?

But when I try the code below, as opposed to what’s shown in the course, it doesn’t throw any error and accepts integer…why?
age = input("What's your age? ")

`age2 = age + 1`

`print("So next year you will be %d years old!" % age2)`

Hi @abdulbasitisdost,

that is because you have to either use python3 instead of python. Or if you prefer just to use python you have to use raw_input instead of input.

Please have a look at the link below where we explain this in more details:

1 Like