Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Write a function greet(name) that shows Hello, followed by the name and an exclamation mark. Call it for Asha and for Ravi.
A parameter lets the same function work with different values.
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. The function has one parameter, name. It builds the message with +.
Calling greet("Asha") shows Hello, Asha!, and greet("Ravi") shows Hello, Ravi!.
One function, two different messages. That is the point of a parameter.
Log in to join the discussion.
Loading…