my name is yuvraj
11. Write Python Programs to do the following:
(i) Display “Hello World!” on the screen.
(ii) Display your name on the screen.
(iii) Assign 5 and 8 in two variables A and B then calculate and display their sum, difference and product.
(iv) Assign 7 in a variables S, which is the sides of a square and then display the area and parameter of the square.
(v) Assign 5 and 15 in two variables L and B, which are length and breadth of a rectangle and then display the area and parameter of the rectangle.
(vi) Assign 10 to R, radius of a circle. Calculate and display the area and circumference of the circle.
(vii) Read a natural number and display square and cube of that number.
(viii) Read a Name and display the same name five time using repetition operator.
(ix) Read two strings and display the concatenated string.
(x) Read a word and display the same word in reverse order.
Answers
Answer:
(i) print('Hello, world!')
(ii) print('Money')
Answer:
i. print("Hello World")
ii. print("Name")
iii. a,b=5,8
print("sum=",a+b)
print("difference=",a-b)
print("Product=",a*b)
iv. s=7
p=4*s
print("perimeter of square=",p)
area=s*s
print("Area of square=",area)
v. l,b=5,15
area=l*b
print("area of rectangle=",area)
c=l+b
peri=2*c
print("perimeter of rectangle=",peri)
vi. r=10
print("Area of the circle=", 3.14*r*r)
print("Circumference of the circle=",2*3.14*r)
vii .a=int(input("Enter a number"))
print("square of the number=",a*a)
print("cube of the number=",a*a*a)
viii. name=input("Enter your name")
print(name*5)
ix. a=input("enter string 1')
b=input("Enter string 2")
print(a+b)
x. a=input("Enter the string to be reversed")
f=a.split()
f=list(reversed(f))
print(" ".join(f))
Explanation: