Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Write a program that asks What is your name? and then shows Hello, followed by the name and an exclamation mark.
input() gives text, and + joins texts.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. Read the name with input(), store it, and put it in the message.
name = input("What is your name? ")print("Hello, " + name + "!"). The + sign joins texts. Notice the space inside "Hello, ".Check. If the user types Asha, the program shows Hello, Asha!.
Log in to join the discussion.
Loading…