0

How can i do this another way? If it is possible. Please check my work)))šŸ™šŸ¼šŸ˜

https://code.sololearn.com/ch0w5xc05am7/?ref=app

11th Mar 2020, 6:42 AM
Dark_Ren
Dark_Ren - avatar
3 Answers
+ 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.
11th Mar 2020, 6:47 AM
Hubert Lang
Hubert Lang - avatar
+ 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 :)
11th Mar 2020, 6:59 AM
Ditus
Ditus - avatar
0
Hubert Lang Oh thanks!
11th Mar 2020, 6:57 AM
Dark_Ren
Dark_Ren - avatar