P1.-

#Jorge Fernando Saldaña Cabal
#A01350730

import math
def distance(x1,y1,x2,y2):
z1=x1-x2
z1=z1**2
z2=y1-y2
z2=z2**2
res=math.sqrt(z1+z2)
return(res)

def main():
x1=int(input(‘Type x1: ‘))
y1=int(input(‘Type y1: ‘))
x2=int(input(‘Type x2: ‘))
y2=int(input(‘Type y2: ‘))
print(‘The distance between those points is: ‘, distance(x1,y1,x2,y2))
return(0)

main()

P2.-

#Jorge Fernando Saldaña Cabal
#A01350730

def fibonacci(a):
x=1
y=0
for i in range(a-1):
z = y + x
y = x
x = z
if (a == 0):
z=0
elif (a==1):
z=1
return(z)

def main():
a =int(input(‘Until which number you want to calculate the fibonacci serie: ‘))
print(‘The fibonacci serie until’, a, ‘is: ‘, fibonacci(a))
return(0)

main()

CC BY 4.0 QUIZ7 by fersabal is licensed under a Creative Commons Attribution 4.0 International License.