22 solutions available
Question 1Assertion (A): The random module is a built-in module to generate pseudorandom variables.Reasoning (R): The randrange() function is used to...
Question 3Assertion (A): The function ceil() is a commonly used function from math module.Reasoning (R): The ceil() function takes a numeric argument...
Question 4Assertion (A): Some of the real-life applications of random module include CAPTCHA, OTP generation, automatic password generator and...
Question 7Assertion (A): Python modules are .py files that contain Python code.Reasoning (R): The import statement allows you to import all the...
Question 8What output will be displayed after executing the following code?statistics.median([11, 22, 33, 44, 55, 66])28.538.55.56.5
Question 2Write a module to input total number of days and find the total number of months and remaining days and display it in another program.
Question 5In how many ways can you import objects from a module?
Question 6How are the following two statements different from each other?(a) import math(b) from math import*
Question 9A program having multiple functions is considered better designed than a program without any functions. Why?
Question 10Write a module called calculate_area() that takes base and height as an input argument and returns an area of a triangle as output. The...
Question 11Rewrite the following Python code after removing all syntax error(s). Underline the corrections done.def main(): r = input('enter any...
Question 12How is math.ceil(89.7) different from math.floor(89.7)?
Question 13Out of random() and randint(), which function should we use to generate random numbers between 1 and 5. Justify.
Question 14What is the difference between import statement and from import statement?
Question 15Why is from import* statement not recommended for importing Python modules in an external program?
Question 16Write a function to calculate volume of a box with appropriate default values for its parameters. Your function should have the following...
Question 17Consider the amount of donations received by a charitable organization given as under:donations = [100, 60, 70, 900, 100, 200, 500, 500,...
Question 18Write a Python program to generate a random number between 0 and 9.Solutionimport random random_number = random.randint(0, 9)...
Question 19Define a function which accepts n as an argument and prints Fibonacci series till n.Solutiondef print_fibonacci(n): a, b = 0, 1...
Question 20Consider the temperature given below for the month of June in North India. Calculate the average temperature and median value. This...
Question 21Create a menu-driven program using user-defined functions to implement a calculator that performs the following:(a) Basic arithmetic...
Question 22Write a program that contains user-defined functions to calculate area, perimeter or surface area whichever is applicable, for various...