Can someone explain to me how I can use the input from one function in another? I have seen different questions but it doesn't make any sense to me: What is the purpose of the return statement?
I am trying to use the input here as the sides of a triangle. The next function should get that input and use it to get the perimeter. I want to be able to use those three sides later on in another function. This is what I have:
#Input Func. using map
def u_input_map():
print("Enter the length of all sides")
lengths = input("Please enter enter the length of all sides in this
format: a, b, c ").split(',')
sides = list(map(int, lengths))
print(sides[0],sides[1],sides[2])
return(sides)
u_input_map()
# Triangle Perimeter Func.
# P = a + b + c
def perim(u_input_map):
all_sides = (sides[0]+sides[1]+sides[2])
print(all_sides)
return sides
perim(u_input_map)
I just want someone to point me in the right direction. I want to figure this out on my own so I don't need the code.