Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
830 views

Getting Started With Python Assignment PDF

The document outlines tasks for a Python introduction session, including manipulating tuples, lists, dictionaries, and sets by concatenating, repeating, accessing, appending, extracting, and printing elements. The tasks involve creating and modifying tuples, lists, dictionaries, and sets with various data types like integers, strings, and booleans and performing common operations on them. The goal is to demonstrate Python fundamentals like data structures, indexing, slicing, and built-in functions.

Uploaded by

Nidhi Bansal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
830 views

Getting Started With Python Assignment PDF

The document outlines tasks for a Python introduction session, including manipulating tuples, lists, dictionaries, and sets by concatenating, repeating, accessing, appending, extracting, and printing elements. The tasks involve creating and modifying tuples, lists, dictionaries, and sets with various data types like integers, strings, and booleans and performing common operations on them. The goal is to demonstrate Python fundamentals like data structures, indexing, slicing, and built-in functions.

Uploaded by

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

Introduction to Python Assignment

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

You might also like