Python || Snippet – How To Input Numbers Into A List & Display Its Contents Back To User

This snippet demonstrates how to place numbers into a list. It also shows how to display the contents of the list back to the user via stdout.

REQUIRED KNOWLEDGE FOR THIS SNIPPET

Python Lists
For Loops


QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.

Once compiled, you should get this as your output

How many items do you want to place into the list?: 3

Enter item #1: 6
Enter item #2: 4
Enter item #3: 2008

The current items inside the list are:
Item #1: 6
Item #2: 4
Item #3: 2008

Was this article helpful?
👍 YesNo

Leave a Reply