To get experience with using lists in programs.
For this lab you will write a program which reads in a list of strings from
the user. You can use the empty string ""
as a terminal
value. So the user can enter as many strings as they want, then hit enter
without entering anything to indicate they are done. Make sure you don't put
the ""
into the list!
Your program will then print out the list of strings backwards. There are two main ways to do this:
Here is an example run:
Enter a string: These Enter a string: are Enter a string: some example Enter a string: words Enter a string: words some example are These
Notice that it reverses the lines. If you put multiple words in one string, like "some example", they aren't reversed themselves. That's OK here!
When you are finished, please submit the .py file for the lab on Canvas. To do so, you'll need to navigate to where you saved the file on your computer.
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.