0
How can i do this another way? If it is possible. Please check my work)))🙏🏼😁
3 Antworten
+ 2
You could use modulo for apples that left. And you don't have the if statement for the situation when there is more apples than kids
Oh, and don't use variable names like single letters. You should use something like kids, kids_number or kids_count. It's not a big problem in simple scripts but it's really unreadable in big projects.
+ 1
kids = int(input("Kids: "))
apples = int(input("Apples: "))
shared = kids//apples
rest = kids%apples
print ("Each child will get " + str(shared)+" apples")
print ("And " + str(rest)+ " apples left")
This is more intuitive I think :)
0
Hubert Lang Oh thanks!