Getting Started With Python Assignment PDF
Getting Started With Python Assignment PDF
Problem Statement:
Consider yourself to be Sam who is a data scientist. He has been invited as a guest lecturer at a college
to take an introductory session on Python.
Tasks to be performed:
1. Create 1st tuple with values -> (10,20,30), 2nd tuple with values -> (40,50,60).
a. Concatenate the two tuples and store it in “t_combine”
b. Repeat the elements of “t_combine” 3 times
c. Access the 3rd element from “t_combine”
d. Access the first three elements from “t_combine”
e. Access the last three elements from “t_combine”
2. Create a list ‘my_list’ with these elements:
a. First element is a tuple with values 1,2,3
b. Second element is a tuple with values “a”,”b”,”c”
c. Third element is a tuple with values True,False
3. Append a new tuple – (1,’a’,True) to ‘my_list’
a. Append a new list – [“sparta”,123] to my_list
4. Create a dictionary ‘fruit’ where:
a. The first key is ‘Fruit’ and the values are (“Apple”,”Banana”,”Mango”,”Guava”)
b. The second key is ‘Cost’ and the values are (85,54,120,70)
c. Extract all the keys from ‘fruit’
d. Extract all the values from ‘fruit’
5. Crete a set named ‘my_set’ with values (1,1,”a”,”a”,True,True) and print the result