More Functions
May 14, 2018
Another attempt at multiplication with slightly better output. Of course, it doesn't need to be math-based - you can use anything. That's the beauty of it.
#multiply two numbers and divide by the third.
def calc(value1, value2, value3):
return value1 * value2 / value3
value1 = (float(raw_input("\nThe number: ")))
value2 = (float(raw_input("\nMultiplied by: ")))
value3 = (float(raw_input("\nDivided by: ")))
answer = calc(value1, value2, value3)
print "\n{0:.0f} multiplied by {1:.0f} and divided by {2:.0f} is: {3:.1f}\n".format (value1, value2, value3, answer)
Recent Entries
- Filter First, Think Later February 21, 2026
- Five Hundred Bugs That Fuzzers Missed February 20, 2026
- Gemini 3.1 Pro and the 0.1 That Matters February 19, 2026