Question
Use Python Spyder to answer: First List Loop (one that you created in lab 1 or any new list) Repeat First List, but this time
Use Python Spyder to answer:
First List Loop (one that you created in lab 1 or any new list)
Repeat First List, but this time use a loop to print out each value in the list.
First Neat List - Loop
Repeat First Neat List, but this time use a loop to print out your statements. Make sure you are writing the same sentence for all values in your list. Loops are not effective when you are trying to generate different output for each value in your list.
Your First List - Loop
Repeat Your First List, but this time use a loop to print out your message for each item in your list. Again, if you came up with different messages for each value in your list, decide on one message to repeat for each value in your list.
Exercises Working List
Make a list that includes four careers, such as 'programmer' and 'truck driver'.
Use the list.index() function to find the index of one career in your list.
Use the in function to show that this career is in your list.
Use the append() function to add a new career to your list. Use the insert() function to add a new career at the beginning of the list.
Use a loop to show all the careers in your list.
Starting From Empty
Create the list you ended up with in Working List, but this time start your file with an empty list and fill it up using append() statements.
Print a statement that tells us what the first career you thought of was.
Print a statement that tells us what the last career you thought of was.
Ordered Working List
Start with the list you created in Working List.
You are going to print out the list in a number of different orders.
Each time you print the list, use a for loop rather than printing the raw list.
Print a message each time telling us what order we should see the list in.
o Print the list in its original order.
o Print the list in alphabetical order.
o Print the list in its original order.
o Print the list in reverse alphabetical order.
o Print the list in its original order.
o Print the list in the reverse order from what it started.
o Print the list in its original order
o Permanently sort the list in alphabetical order, and then print it out.
o Permanently sort the list in reverse alphabetical order, and then print it out.
Ordered Numbers
Make a list of 5 numbers, in a random order.
You are going to print out the list in a number of different orders.
Each time you print the list, use a for loop rather than printing the raw list.
Print a message each time telling us what order we should see the list in.
o Print the numbers in the original order.
o Print the numbers in increasing order.
o Print the numbers in the original order.
o Print the numbers in decreasing order.
o Print the numbers in their original order.
o Print the numbers in the reverse order from how they started.
o Print the numbers in the original order.
o Permanently sort the numbers in increasing order, and then print them out.
o Permanently sort the numbers in descreasing order, and then print them out.
List Lengths
Copy two or three of the lists you made from the previous exercises, or make up two or three new lists.
Print out a series of statements that tell us how long each list is.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started