This is my first ever question. I’m working on a zybooks lab (6.12.1) – I’m pretty excited that I’ve actually wrote the code and it mostly works – THe problem I am having is that the average I am calculating is printing out with a decimal. I struggle with formatting but if I could get a hint with how to format it so the number shows as 10 vs 10.0 I would be very grateful (I Could google the answer and I could use Stack to find it but I need some more activity to rank up)!
I tried this:
user_input = input()
numbers= []
for i in user_input.split():
numbers.append(int(i))
print (sum(numbers)/len(numbers), max(numbers)) `
Program input 15 20 0 5
Print shows: 10.0 20
Expected: 10 20
Cheryl8300 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.