Assignment 1 Data Type
Assignment 1 Data Type
1. Construct 2 lists containing all the available data types (integer, float,
string, complex and Boolean) and do the following. a. Create another list by
concatenating above 2 lists b. Find the frequency of each element in the
concatenated list. c. Print the list in reverse order.
Answer –#Construct 2 lists containing all the available data types (integer,
float, string, complex and Boolean)list1 =
[1,1.24,"list1",complex(5,2),True]print("list1 :", list1)
Answer –
This study source was downloaded by 100000789086474 from CourseHero.com on 01-09-2023 00:15:51 GMT -06:00
https://www.coursehero.com/file/181063602/assignment-1-data-typedocx/
if(x ^ y): print (str(x ^ y)) #(XOR operator) else: print ("No Uncommon
elements")uncommon_items(a, b)
3. Create a data dictionary of 5 states having state name as key and number
of covid-19 cases as values. a. Print only state names from the dictionary. b.
Update another country and it’s covid-19 cases in the dictionary.
Answer –
Output –
This study source was downloaded by 100000789086474 from CourseHero.com on 01-09-2023 00:15:51 GMT -06:00
https://www.coursehero.com/file/181063602/assignment-1-data-typedocx/
This study source was downloaded by 100000789086474 from CourseHero.com on 01-09-2023 00:15:51 GMT -06:00
https://www.coursehero.com/file/181063602/assignment-1-data-typedocx/
Powered by TCPDF (www.tcpdf.org)