Python Function Program with argument and without return value
top of page

Python Function Program with argument and without return value


This type of function has one or more input arguments but does not have any value to return to the main program.

Write a program to input a number and print its table up to 10 terms.

Program:

def table(num):

for i in range(1, 11):

print(num, 'x', i, '=', num*i)

return

n = int(input("Enter number: "))

table(n)

Output:

Enter number: 5

5 x 1 = 5

5 x 2 = 10

5 x 3 = 15

5 x 4 = 20

5 x 5 = 25

5 x 6 = 30

5 x 7 = 35

5 x 8 = 40

5 x 9 = 45

5 x 10 = 50



1,627 views1 comment

Recent Posts

See All

Python program to calculate the factorial of a number

Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. This program is most for O Level Practical Exam so read it care

NumPy program to find the most frequent value in the list.

This program is most for O Level Practical Exam so read it carefully. Program: import numpy as np x = np.array([1,2,3,4,5,7,2,1,1,1,8,9,1]) print(x) print("most frequent value in the list:") print(np.

bottom of page