HR6002 / BMA

GNU General Public License v3.0
0 stars 0 forks source link

decompose further #1

Open ecoppen opened 2 years ago

ecoppen commented 2 years ago

https://github.com/HR6002/programming-challenges-/blob/17c82adbdfce3b000d6bf07c4e783691b938a671/challenge1.py#L17-L23

Separate this into two functions, one for the input the other for the printing. Pass the return from the input function to the print/calculations.

HR6002 commented 2 years ago

done.....

ecoppen commented 2 years ago

Not quite https://github.com/HR6002/programming-challenges-/blob/478bbe2425a7ad69429aa74d01718e055a193260/challenge1.py#L17-L19

This function should get the user input and return it as a floating point:

def userinput(user): 
    return float(input("enter number of rods: "))

https://github.com/HR6002/programming-challenges-/blob/478bbe2425a7ad69429aa74d01718e055a193260/challenge1.py#L21-L27

This function needs to get the input value within it and then use it:

def printing():
    rods = userinput()
    print(f""" meters:{meters(rods))}  
    feet: {feet(meters(rods))} 
    miles: {miles(meters(rods))} 
    furlongs: {furlongs(rods)} 
    walking time in minutes : {walk(miles(meters(rods)))} 
    """) 

https://github.com/HR6002/programming-challenges-/blob/478bbe2425a7ad69429aa74d01718e055a193260/challenge1.py#L28-L30

This just becomes:

if __name__ == "__main__":
    printing()