0
Is there a shorter way to write this codes?
fruit = int(input()) #your code goes here # Take the total number of fruits and divide by two to find the total amount of apples. Then check if the apples can be divided by 3. # If it is divisible, print out the quotient. else print out the nearest divisible number. apples = fruit/2 if apples % 3 == 0: print(int(apples/3)) else: remainder = apples % 3 output = (apples - remainder)/3 print(int(output))
3 Réponses
+ 2
# for myself:
print((int(input())//2)//3)
0
U can use ternary operator in print
0
Thank you, it works perfectly