Sheet (1)
Python programming
1. Write a Python program to print "30+20=50". Given variables x=30 and y=20.
2. Write a Python program which accepts the user's first and last name and print them in reverse order with a space
between them.
3. Convert the following formulas into Python code statements:
a. 𝑌 = 𝑥 3 + 3𝑥 2 + 3𝑥 + 1
b.𝑦 = √𝑥 + 1*√𝑥 + 2*√𝑥 + 3
4. Write a Python code to do the following:-
a. To add two numbers.
b. To subtract two numbers.
c. To multiply two numbers. d. To divide two numbers.
5. Write a program to calculate the area of a triangle.
6. Write a Python program to get the volume of a sphere with radius 6.
7. Write a Python code that accepts the radius of a circle and prints its area and perimeter.
a. Area = Pi* r2
b. Perimeter = 2*Pi*r
8. Write a Python program to swap two variables by using a temporary variable and, without using temporary variable.