Simple function: def print_multiplication_table(): for i in range(2, 21): print("Multiplication Table of", i) for j in range(1, 11): print(i, "x", j, "=", i*j) print("\n") print_multiplication_table() Parameterized function: def print_multiplication_table(table): print("Multiplication Table oRead more
Simple function:
def print_multiplication_table():
for i in range(2, 21):
print(“Multiplication Table of”, i)
for j in range(1, 11):
print(i, “x”, j, “=”, i*j)
print(“\n”)
print_multiplication_table()
Parameterized function:
def print_multiplication_table(table):
print(“Multiplication Table of”, table)
for i in range(1, 11):
print(table, “x”, i, “=”, table*i)
print(“\n”)
for i in range(2, 21):
print_multiplication_table(i)
Return type with function:
def get_multiplication_table(table):
table_list = []
for i in range(1, 11):
table_list.append(table*i)
return table_list
for i in range(2, 21):
table = get_multiplication_table(i)
print(“Multiplication Table of”, i)
for j in range(10):
print(i, “x”, j+1, “=”, table[j])
print(“\n”)
Return type with parameterized function:
def get_multiplication_table(table):
table_list = []
for i in range(1, 11):
table_list.append(table*i)
return table_list
def print_multiplication_table(table):
table = get_multiplication_table(table)
print(“Multiplication Table of”, table)
for i in range(10):
print(table[i])
print(“\n”)
for i in range(2, 21):
print_multiplication_table(i)
1.SIMPLE FUNCTION def calculate_area():pie = 22/7for i in range(10):radius = float(input("Enter the radius of the circle: "))area = pie * radius**2print("The area of the circle with radius", radius, "is", area) calculate_area() 2. PARAMETERIZED FUNCTION def calculate_area(radius):pie = 22/7area = piRead more
1.SIMPLE FUNCTION
def calculate_area(): pie = 22/7 for i in range(10): radius = float(input(“Enter the radius of the circle: “)) area = pie * radius**2 print(“The area of the circle with radius”, radius, “is”, area)
calculate_area()
2. PARAMETERIZED FUNCTION
def calculate_area(radius): pie = 22/7 area = pie * radius**2 return area
for i in range(10): radius = float(input(“Enter the radius of the circle: “)) area = calculate_area(radius) print(“The area of the circle with radius”, radius, “is”, area)
3. RETURN TYPE WITH FUNCTION
def calculate_area(radius): pie = 22/7 area = pie * radius**2 return area
for i in range(10): radius = float(input(“Enter the radius of the circle: “)) area = calculate_area(radius) print(“The area of the circle with radius”, radius, “is”, area)
def get_circle_area(radius_list): area_list = [] for radius in radius_list: area = calculate_area(radius) area_list.append(area) return area_list
radius_list = [] for i in range(10): radius = float(input(“Enter the radius of the circle: “)) radius_list.append(radius)
area_list = get_circle_area(radius_list) for i in range(10): print(“The area of the circle with radius”, radius_list[i], “is”, area_list[i])
4. Return type with parameterized function:
def calculate_area(radius):
pie = 22/7 area = pie * radius**2 return area
def get_circle_area(radius_list): area_list = [] for radius in radius_list: area = calculate_area(radius) area_list.append(area) return area_list
radius_list = [] for i in range(10): radius = float(input(“Enter the radius of the circle: “)) radius_list.append(radius)
area_list = get_circle_area(radius_list) for i in range(10): print(“The area of the circle with radius”, radius_list[i], “is”, area_list[i])
Write a python program to print Multiplication tables from 2 to 20 whether table values entered by user using Simple …
Simple function: def print_multiplication_table(): for i in range(2, 21): print("Multiplication Table of", i) for j in range(1, 11): print(i, "x", j, "=", i*j) print("\n") print_multiplication_table() Parameterized function: def print_multiplication_table(table): print("Multiplication Table oRead more
def print_multiplication_table():
for i in range(2, 21):
print(“Multiplication Table of”, i)
for j in range(1, 11):
print(i, “x”, j, “=”, i*j)
print(“\n”)
print_multiplication_table()
def print_multiplication_table(table):
print(“Multiplication Table of”, table)
for i in range(1, 11):
print(table, “x”, i, “=”, table*i)
print(“\n”)
for i in range(2, 21):
print_multiplication_table(i)
def get_multiplication_table(table):
table_list = []
for i in range(1, 11):
table_list.append(table*i)
return table_list
for i in range(2, 21):
table = get_multiplication_table(i)
print(“Multiplication Table of”, i)
for j in range(10):
print(i, “x”, j+1, “=”, table[j])
print(“\n”)
def get_multiplication_table(table):
table_list = []
for i in range(1, 11):
table_list.append(table*i)
return table_list
def print_multiplication_table(table):
table = get_multiplication_table(table)
print(“Multiplication Table of”, table)
for i in range(10):
print(table[i])
print(“\n”)
for i in range(2, 21):
See lessprint_multiplication_table(i)
Write a python program to calculate area of 10 different circles. Given the pie = 22/7 and radius of the …
1.SIMPLE FUNCTION def calculate_area():pie = 22/7for i in range(10):radius = float(input("Enter the radius of the circle: "))area = pie * radius**2print("The area of the circle with radius", radius, "is", area) calculate_area() 2. PARAMETERIZED FUNCTION def calculate_area(radius):pie = 22/7area = piRead more
1.SIMPLE FUNCTION
def calculate_area():
pie = 22/7
for i in range(10):
radius = float(input(“Enter the radius of the circle: “))
area = pie * radius**2
print(“The area of the circle with radius”, radius, “is”, area)
calculate_area()
2. PARAMETERIZED FUNCTION
def calculate_area(radius):
pie = 22/7
area = pie * radius**2
return area
for i in range(10):
radius = float(input(“Enter the radius of the circle: “))
area = calculate_area(radius)
print(“The area of the circle with radius”, radius, “is”, area)
3. RETURN TYPE WITH FUNCTION
def calculate_area(radius):
pie = 22/7
area = pie * radius**2
return area
for i in range(10):
radius = float(input(“Enter the radius of the circle: “))
area = calculate_area(radius)
print(“The area of the circle with radius”, radius, “is”, area)
def get_circle_area(radius_list):
area_list = []
for radius in radius_list:
area = calculate_area(radius)
area_list.append(area)
return area_list
radius_list = []
for i in range(10):
radius = float(input(“Enter the radius of the circle: “))
radius_list.append(radius)
area_list = get_circle_area(radius_list)
for i in range(10):
print(“The area of the circle with radius”, radius_list[i], “is”, area_list[i])
4. Return type with parameterized function:
def calculate_area(radius):
pie = 22/7
area = pie * radius**2
return area
def get_circle_area(radius_list):
area_list = []
for radius in radius_list:
area = calculate_area(radius)
area_list.append(area)
return area_list
radius_list = []
for i in range(10):
radius = float(input(“Enter the radius of the circle: “))
radius_list.append(radius)
area_list = get_circle_area(radius_list)
See lessfor i in range(10):
print(“The area of the circle with radius”, radius_list[i], “is”, area_list[i])