Refresher Challenge¶
This assignment is almost the same as A Refresher.
Write a program that prompts the user for a name. Then display that name ten times using a loop. However, if the name given is "Harambe"
, display it only five times.
So here’s the challenge: write the program using only one if
statement (no else
) and only one for
loop.
Name the file refresher2.py
Your name: gump
gump
gump
gump
gump
gump
gump
gump
gump
gump
gump
Your name: Harambe
Harambe
Harambe
Harambe
Harambe
Harambe
©2021 Daniel Gallo
This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Adapted for Python from Graham Mitchell’s Programming By Doing