Python 3.6.1.9 LAB: Operating with lists - basics
3.6.1.9 LAB
If you're taking PCAP - Programming Essentials In Python , you may have encountered this question 3.6.1.9 LAB: Operating with lists - basics.
Objectives
Familiarize the student with:
- list indexing;
- utilizing the in and not in operators.
Scenario
Imagine a list - not very long, not very complicated, just a simple list containing some integer numbers. Some of these numbers may be repeated, and this is the clue. We don't want any repetitions. We want them to be removed.
Your task is to write a program which removes all the number repetitions from the list. The goal is to have a list in which all the numbers appear not more than once.
Note: assume that the source list is hard-coded inside the code - you don't have to enter it from the keyboard. Of course, you can improve the code and add a part that can carry out a conversation with the user and obtain all the data from her/him.
Hint: we encourage you to create a new list as a temporary work area - you don't need to update the list in situ.
We've provided no test data, as that would be too easy. You can use our skeleton instead.
Solution Code
And here's what is happening inside the code:
=================================================================================
0 Comments
Your opinion matters, your voice makes us proud and happy. Your words are our motivation.