Copy of Questions to Answer python.ipynb - Colab
Copy of Questions to Answer python.ipynb - Colab
Write a program in python that prints"The whole world is interdependent and a constant stream
of thought has throughout ages enriched the common heritage of mankind".
print("The whole world is interdependent and a constant stream of thought has throughout age
The whole world is interdependent and a constant stream of thought has throughou
Q 2..Write a program in python that asks the user for their favorite color and then displays "Your
favorite color is [color]!"
Q. 3.Write a program in python that takes two numbers from the user and prints their sum, division,
multiplication, substraction, reminder..
Q. 5.Write a program in python to calculate the area of a circle. Take the radius as input from the
user.
Area=3.14*R**2
print ("Area of the cricle is",Area)
Q. 6.Write a program in python that calculates simple interest given the principal amount, rate, and
time.
Q. 7. Write a program in python that prints the sum of the first twenty integer,even and odd
numbers.
x=int(input("Enter the number of how many first even numbers you want to sum:"))
R=2*x+1
T=0
for i in range(2,R,2):
T=T+i
print("the sum of the first",x,"even numbers is ",T)
Enter the number of how many first even numbers you want to sum:20
the sum of the first 20 even numbers is 420
y=int(input("Enter the number of how many first odd numbers you want to sum:"))
R=2*y+1
W=0
for i in range(1,R,2):
W=W+i
print("the sum of the first",y,"odd numbers is",W)
Enter the number of how many first odd numbers you want to sum:20
the sum of the first 20 odd numbers is 400
Q. 8. Write a program in python that takes a year from the user and prints wheather it is leap year or
not.