Unit 3 - Python

Unit 3 - Lesson 10

33.1.1. Write a program to calculate the number of days elapsed since the birthday. from datetime import datetime def dayCount(dob,date): a…

Unit 3 - Lesson 9

32.1.1. Understanding Trigonometric Functions import math print("degrees 0 30 45 60 90") #convert the given degrees to radians a=…

Unit 3 - Lesson 8

31.1.1. Understanding Mathematical Functions import math num = float(input("num: ")) if (num - int(num) >= 0.5): print ("…

Unit 3 - Lesson 7

30.1.1. Recursion - An overview (a) A function call when made within the definition of the same function is known as a recursion function. (c…

Unit 3 - Lesson 6

29.1.1. Local variables - an overview def test1(): a=50 b=80 print(a,b) #complete the function def test2(): a=22 b=44 print(a,b) #com…

Unit 3 - Lesson 5

28.1.1. Fruitful functions - an overview (a) A fruitful function is a function, it returns a value when it is called. (b) A return statement …

Unit 3 - Lesson 4

27.1.1. Introduction to Lambda Function (a) Anonymous functions are also called lambda functions. (b) Lambda functions can be used anywhere w…

Unit 3 - Lesson 3

26.1.1. What are default arguments? def simplecalc(a,b=100 ): #fill in the missing code.. print("addition:", a+b) print("…

Unit 3 - Lesson 2

25.1.1. Parameters/Arguments (a) An argument is an expression which is passed to a function by its caller, in order for the function to perfo…

Unit 3 - Lesson 1

24.1.1. What is a function (a) A function can be called many number of times. (b) A Function is a block of statements to do one or more tasks…