Click Run & Test (or press Ctrl+Enter) to see results.
You'll write and run your first Python program to display a personalized greeting on the screen.
Look at the editor on the right. Two lines of real Python are already there. Like you saw in the last lesson, Python skips the grey # comment lines entirely.
message = "hello, world"
print(message)Both lines do something important. Here is what each line does.
Line 1: message = "hello, world"
The = sign is called assignment. It does not mean "equals" the way it does in math. Read it as "gets". So this line says: "the name message gets the value hello, world". After this line runs, Python remembers that whenever you say message, you mean hello, world.
The text "hello, world" is called a string - that's just the name programmers use for text wrapped in quotes. Any text inside double or single quotes is a string in Python.
A name like message is called a variable. Programs use variables to remember things: numbers, text, dates, anything.
Line 2: print(message)
The print() function from the last lesson is how you display the variable on the screen.
Line 2 says: "display whatever message is right now". Since we set message to "hello, world" on line 1, that's what will appear.
Right now the program prints hello, world. Your job is to make it greet you by name.
Edit the text between the quotes on line 1 so that:
Hello, not hello).world.A correct answer looks like "Hello, Ada!" or "Hello, Samir!" - anything that starts with Hello, and uses your name.
Click Run & Test. You should see your personalized greeting in the output and all three tests pass.
If your tests fail, read the red message carefully. The tests will tell you exactly what they expected. Common misses:
H. "hello, Ada!" won't pass; "Hello, Ada!" will."Hello, Ada", not "Hello,Ada".Make your fix and click Run & Test again. The platform will re-check everything from scratch.
print(value) puts a value on the screen.name = value gives a value a name so you can use it later. The = is assignment ("gets"), not equals.