0

Python- Metric to SAE Math

Working on python math to convert Metric Socket to SAE (Society of Automotive Engineers) sockets. My code mm = float(input("Enter Socket MM: ")) round(mm*0.39216,2) output Enter Socket MM: 13 I get 5.1 hoping for 13mm == 0.531 upon building on the above answer of 0.531 then want the code print out SAE equivalent 17/32 socket Thanks

16th Aug 2021, 10:16 PM
Wes
2 ответов
+ 1
Sounds like an interesting project. This should get you started import math mm = float(input()) sae = round(mm * 0.03937,3) print(sae) print(f"{math.ceil(32 * sae)}/32")
16th Aug 2021, 10:58 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Thanks (mate) Rik
17th Aug 2021, 3:03 PM
Wes