Unit 2 - Python

Unit 2 - Lesson 9

23.1.1. Python Program to print Fibonacci series n = int(input("n: ")) #write your code here a = 0 b = 1 while a<=n: print(a) …

Unit 2 - Lesson 8

22.1.1. Understanding pass statement #write your code here n = int(input("n: ")) for num in range(1,n): if num%2 != 0: pass el…

Unit 2 - Lesson 7

21.1.1. Understanding Continue statement for num in range(1, 20): # skip all the numbers below 10 if num in range(1,11): continue # print…

Unit 2 - Lesson 6

20.1.1. Usage of break statement n = int(input("n: ")) m = int(input("m: ")) for i in range(n, m): if(i%5 == 0): pr…

Unit 2 - Lesson 5

19.1.1. Understand the For-loop construct numbers = [int(x) for x in input().split()] s = 0 #Find sum of all the numbers using for loop for…

Unit 2 - Lesson 4

18.1.1. Understanding While loop n = int(input("num: ")) sum = 0 i = 0 while i<n: i = i + 1 if(i%2==0): sum = sum + i print…

Unit 2 - Lesson 3

17.1.1. Understanding if-elif-else construct ch = input("ch: ") # write the logic to find whether the input is a character or a d…

Unit 2 - Lesson 2

16.1.1. Understanding if-else construct distinction_marks = 75 marks = float(input("marks: ")) # write your code here if (marks &g…

Unit 2 - Lesson 1

15.1.1. Understanding Control Flow Statements (a) Selection Statements (c) Iterative Statements 15.1.2. Understanding If construct num …