Python Programming Problems

Python Programming Problems

........................................................................................................................................Q1. Write a Python program to print any word.

print("Hello Python")    # Print(): It shows text or numbers on the screen.

Output: Hello Python

---------------------------------------------------------------------------------------------------------------

Q2. Write a Python program to input two numbers from the user and print their sum.

#input two numbers from the user.

a=int(input("Enter the first number:"))

b=int(input("Enter the second number:"))

sum=a+b

print("sum of two numbers=",sum)       #print( ) function is used to display output to console or screen.

Output: 

Enter the first number: 20

Enter the second number: 40

sum of two numbers=60

Q3. Write a Python program to input two numbers from the user and print their product.

a=int(input("Enter the first number:"))

b=int(input("Enter the second number:"))

product=a*b

print("multiply of two numbers=",product       #print( ) function is used to display output to console or screen.

Output: 

Enter the first number: 20

Enter the second number: 40

multiply of two numbers=800

Q4. Write a Python program to swap the values of two numbers using third variable. 

a=int(input("Enter the first number:"))

b=int(input("Enter the second number:"))

c=a # a=10 



Comments

Popular posts from this blog

Class IX th :IT(INFORMATION TECHNOLOGY)-402

ICT-SKILLS Notes for Class 9

Entrepreneur Skills Notes for Class 9 Students