0% found this document useful (0 votes)
799 views3 pages

20 Python Programs

This document provides examples of 7 basic Python programs: 1) Find the sum of two numbers. 2) Subtract two numbers. 3) Print the multiplication table of a number. 4) Find the factorial of a number. 5) Find the sum of the first n natural numbers. 6) Reverse a string. 7) Determine if a number is even or odd. Each program example lists the expected input and output.

Uploaded by

uplifter40
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
799 views3 pages

20 Python Programs

This document provides examples of 7 basic Python programs: 1) Find the sum of two numbers. 2) Subtract two numbers. 3) Print the multiplication table of a number. 4) Find the factorial of a number. 5) Find the sum of the first n natural numbers. 6) Reverse a string. 7) Determine if a number is even or odd. Each program example lists the expected input and output.

Uploaded by

uplifter40
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

20 PYTHON PROGRAMS

1. Python program to find sum of two numbers:


Input:

Output:

2. Python program to subtract numbers:


Input:

Output:

3. Python program to print table of any number:


Input:
Output:

4. Python program to find factorial of any number:


Input:

Output:

5. Write python program to find sum of n natural numbers:


Input:

Output:

6. Write python program to reverse a string:


Input:

Output:

7. Write python program find even or odd:


Input:

Output:

You might also like