Untitled
unknown
plain_text
2 years ago
935 B
18
Indexable
# initializing the variables
distance_in_km = 10
distance_in_miles = 10/1.61
time_taken = 43.5
# printing the required result
print("Average speed in miles per hour is ", distance_in_miles/(43.5/60))
#Calculate the simple interest
# Initializing the variables
principle = float(input("Enter the principle value : "))
timee = float(input("Enter the time in years : "))
rate = float(input("Enter the rate : "))
# printing the result
print("Simple interest on your money invested is ", (principle * timee * rate)/100)
# Factorial
def factorial(a):
fact = 1
for i in range (1,a+1):
fact*=i
return fact
# Fibonacci Series
def fibbo(a):
if(a<1):
if(a==0):
return 0
else:
return 1
else:
return fibbo(a-1)+fibbo(a-2)
n = int(input("Enter the value of n : "))
print("Factorial of ",n," is : ",factorial(n))
print("Fibonacci of ",n," is : ",fibbo(n))Editor is loading...
Leave a Comment