Unit 4 - Python

Unit 4 - Lesson 16

49.1.1. Dictionary Comprehensions start = int(input()) end = int(input()) #fill in the missing code.. cube_dict = {num: num ** 3 for num i…

Unit 4 - Lesson 15

48.1.1. Understanding Set Comprehensions n1 = int(input("n1: ")) n2 = int(input("n2: ")) #fill in the missing code.. m…

Unit 4 - Lesson 14

47.1.1. Understanding List Comprehensions #take a string from the user str1 = input("str: ") l1 = [i for i in str1] #fill in the …

Unit 4 - Lesson 13

46.1.1. Methods and Functions for set (c) s1 = {1, 2} s1.add(5) s2 = s1.copy() will result in s1 = {1, 2, 5} and s2 = {1, 2, 5} (e) You can…

Unit 4 - Lesson 12

45.1.1. Introduction to Sets (b) It stores only unique elements and offers various set operations. 45.1.2. Introduction to Frozenset (a)…

Unit 4 - Lesson 11

44.1.1. Understand the Methods in Dictionary #write your code here d1 = input("data1: ").split(",") d2 = input("dat…

Unit 4 - Lesson 10

43.1.1. Understanding dictionary functions data1 = input("data1: ") data2 = input("data2: ") list1 = data1.split(",…

Unit 4 - Lesson 9

42.1.1. Introduction to Dictionaries (c) A dictionary is a collection of unordered elements and each element will in the form a key: value pa…

Unit 4 - Lesson 8

41.1.1. Understanding the Built-in Tuple Functions > (a) enumerate() method starts an index from 0. (b) any(' ', ' ', '…

Unit 4 - Lesson 7

40.1.1. Introduction to tuples (c) Tuples can be used as keys in dictionaries. (d) Elements of a tuple are enclosed in parenthesis. (f) It is…

Unit 4 - Lesson 6

39.1.1. Overview of List methods (a)append() (b)extend() (c)insert(index, item) (d)remove(element) (e)pop() 39.1.2. Overview of List method…

Unit 4 - Lesson 5

38.1.1. Understanding List functions data = input("data: ") list1 = data.split(",") #find the length size = len(list1) #…

Unit 4 - Lesson 4

37.1.1. Understand the List Operations (a)l1 = [1, 20, 30, 40] index of l1 starts from 0. 37.1.2. Create and access a List # write your…

Unit 4 - Lesson 3

36.1.1. Introduction to Lists (c)Lists are ordered and can contain other lists as elements. 36.1.2. Understanding Creation of List data…

Unit 4 - Lesson 2

35.1.1. Functions of String Data Type (a)In Python, we can convert strings of Uppercase letters into lower case and lower case to upper case …

Unit 4 - Lesson 1

34.1.1. Introduction to Strings str= input("str: ") print(str) 34.2.1. Operations of Strings # Prompt the user to enter a …