Posted on

3 Tuple Comprehension a Create a tuple with numbers from 1 to 10 b Create a new tuple that

3. Tuple Comprehension: a. Create a tuple with numbers from 1 to 10. b. Create a new tuple that contains the squares of each number in the original tuple using tuple comprehension. c. Print the original and new tuple. 4. Dictionary and List: a. Create a dictionary of items and their prices. b. Create a shopping list as a list of tuples, where each tuple contains an item and the quantity you want to buy. c. Calculate the total cost of your shopping list. d. Print out the items and quantities in your shopping list along with their total cost. 5. Given the following two lists, print the elements from the color list whose index is listed in the favorite list: color = [Red, Green, White, Black, Pink, Yellow] favorite = [1, 4, 3]

3. Tuple Comprehension:
a. Create a tuple with numbers from 1 to 10.
b. Create a new tuple that contains the squares of each number in the original tuple using tuple comprehension.
c. Print the original and new tuple.

4. Dictionary and List:
a. Create a dictionary of items and their prices.
b. Create a shopping list as a list of tuples, where each tuple contains an item and the quantity you want to buy.
c. Calculate the total cost of your shopping list.
d. Print out the items and quantities in your shopping list along with their total cost.

5. Given the following two lists, print the elements from the color list whose index is listed in the favorite list:
color = [Red, Green, White, Black, Pink, Yellow]
favorite = [1, 4, 3]


 
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.

 
Instant
Download

Student review: (5 ratings) 5 out of 5 people found this solution helpful.