input | Coursera Community
Coursera Header
Question

input


Badge +1

 

Can anyone tell me what is wrong with my work ? I’m confused why doesn’t nam come out as Sarah. 


6 replies

Badge

just write…

 

nam = input()

print(‘Hello’, nam)

 

input() function ask data form user, once you run the above a new window will pop up, whatever(this time  Sarah) you enter, that will be printed in the output.

Badge +1

Ah I got it!  Thank you Abhijit, your explanation is much better than the video, I’ve been watched it many times still couldn’t figure it out, I guess that’s the downside of online learning. 

Badge

Thank you for the complement...

Badge

 

ABHIJIT is correct! input() will create a window for the user to enter whatever they want. If you do not want the user to enter, and if you want to just put Sarah in the code yourself then doing this would also work:

nam  =  ‘Sara’

print(‘Hello’, nam)

Badge +1

 

ABHIJIT is correct! input() will create a window for the user to enter whatever they want. If you do not want the user to enter, and if you want to just put Sarah in the code yourself then doing this would also work:

nam  =  ‘Sara’

print(‘Hello’, nam)

ah , there is another way ! Thanks Hakki. 

Userlevel 1
Badge +1

There are so many ways to do the same thing using computer science.

 

I would like to talk to you... Please reach me via whatsapp at +918200713617

Reply