0% found this document useful (0 votes)
465 views

Day 6 Assignment

The document outlines 8 Python tasks: 1) Concatenate two lists index-wise; 2) Square each item in a list; 3) Iterate through two lists simultaneously in original and reverse order; 4) Remove empty strings from a list; 5) Access a value from a nested tuple; 6) Unpack a tuple into variables; 7) Modify an item in a nested list; 8) Count occurrences of an item in a tuple.

Uploaded by

Sumit Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
465 views

Day 6 Assignment

The document outlines 8 Python tasks: 1) Concatenate two lists index-wise; 2) Square each item in a list; 3) Iterate through two lists simultaneously in original and reverse order; 4) Remove empty strings from a list; 5) Access a value from a nested tuple; 6) Unpack a tuple into variables; 7) Modify an item in a nested list; 8) Count occurrences of an item in a tuple.

Uploaded by

Sumit Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Day 6 Assignment

1. Concatenate two lists index-wise

Input
list1 = ["M", "na", "i", "Ke"]

list2 = ["y", "me", "s", "lly"]

Output
['My', 'name', 'is', 'Kelly']

2. Given a Python list. Turn every item of a list into its square
3. Given a two Python list. Iterate both lists simultaneously
such that list1 should display item in original order and list2
in reverse order

4. Remove empty strings from the list of strings

list1 = ["Mike", "", "Emma", "Kelly", "", "Brad"]

Expected output:

["Mike", "Emma", "Kelly", "Brad"]

5. Access value 20 from the following tuple

aTuple = ("Orange", [10, 20, 30], (5, 15, 25))

6. Unpack the following tuple into 4 variables


aTuple = (10, 20, 30, 40)

Expected output:

aTuple = (10, 20, 30, 40)


# Your code

print(a) # should print 10

print(b) # should print 20

print(c) # should print 30

print(d) # should print 40

7. Modify the first item (22) of a list inside a following tuple to


222
tuple1 = (11, [22, 33], 44, 55)

8. Counts the number of occurrences of item 50 from a tuple


tuple1 = (50, 10, 60, 70, 50)

You might also like