Quiz 3

Program 1:
x1= int (input (“Give me the value of x1: “))
y1= int (input (“Give me the value of y1: “))
x2= int (input (“Give me the value of x2: “))
y2= int (input (“Give me the value of y2: “))

def distance (x1,x2,y1,y2):

d= (((x2-x1)**2)+((y2-y1)**2))**0.5
print (“The distance is: “)
return d

print (distance(x1,x2,y1,y2))

 

Program 2:

n=int (input(“Give me a number so I can give you the equivalent in the fibonacci series: “)
def fibonacci (n):
if (n==0):
return 0
elif (n==1):
return 1
else:
return fibonacci(n-1)+fibonacci(n-2)

print(fibonacci(n))

 

 

CC BY-SA 4.0 Quiz 3 by alextenablog is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.