BPP 313011 Practical No.13: Create a program to demonstrate use of: Built-in module (e.g. numeric, mathematical functional and programming module) in Python
Python's built-in modules for file handling and input/output (I/O) operations offer a wide range of tools and functions for reading, writing, and manipulating files and data streams. These modules are essential for working with files, whether for data processing, text manipulation, or data storage.
Practical related Questions
1. Write the output of the following program.
import math
def circle_area(r):
return math.pi*r**2
radius = 3
print("Area =", circle_area(radius))
Answer:
Area = 28.274333882308138
2. Write the output of the following program.
import fractions
for deci in ['0.6', '2.5', '2.3', '4e-1']:
fract = fractions.Fraction(deci)
print(fract)
Answer:
3/5
5/2
23/10
2/5
Exercise
1. Write a Python script to calculate the DC output voltage(Vdc) of Half wave rectifier using Formula: Vdc=(Vm/π) where Vm is the peak value of output voltage using math module.
Answer:
2. Write a Python script to calculate the Area of cross section of the wire, A = π*d2 /4 = m2 where d is the diameter of wire.
Answer:
3. Write a Python Script by using statistics module to calculate mean (average value), median (middle value), mode (most often value), standard deviation (spread of values).
Answer: