def cummulative_product(n): l=[] product=1 print("Read The List Of Elements Upto:",n) for i in range(n): ele=int(input()) l.append(ele) for i in l: product=product*i return product n=int(input("Enter Size Of List:")) print("The Cummulative Product Of The List is:",cummulative_product(n))
1)b)Write a Python program to compute distance between two points taking input from the user. Formula for Pythagorean theorem for compute distance between two points is: n1=int(input("Enter the value of point 1_ x-axis")) n2=int(input("Enter the value of point 1_y-axis")) n3=int(input("Enter the value of point 2 _x-axis ")) n4=int(input("Enter the value of point 2_y-axis")) distance=(((n3-n1)**2)+((n4-n2)**2))**(0.5) print("The distance for the given two cartesian points are ",distance)
Comments
Post a Comment