The below program is your first program to write. After the code, see the explanation about it.
# The following program greets you and ask your name.
> print ("Hello!")
> print ("What is your name?")
> coderName = input()
> print ("Hello, " + coderName + "! Its nice to meet you.")
Line 1: denotes a standard command to print anything you ask for. In this case, it will print Hello!
Line 2: prints a question on your screen.
Line 3: input command is used to ask input for the question asked in Line 2 from the user. This input will be assigned to the variable, codeName to be used later in the program.
Line 4 will print greetings along with the name provided by the user in Line 3.
Results:
Leave a Reply