+ 3

Problem in code coach

Im trying to solve code coaches but Im consistently facing a common problem in both of my codes Ive to crack two test cases in once but have to make sure that both of results should be seperated from each others I did everything possible for me to do but Still facing the problem of cant seperating results of both from each others someone knows about it or if solo learn has a different method for it?

15th Sep 2024, 10:20 AM
Kavya Saxena
Kavya Saxena - avatar
3 Réponses
+ 5
show your code give a complete task description if the task asks to handle input, you need to get input.
15th Sep 2024, 10:24 AM
Lisa
Lisa - avatar
+ 5
don't hard-code the input use input()
15th Sep 2024, 10:36 AM
Lisa
Lisa - avatar
+ 3
def calculate_pies(total_fruit): # Calculate number of apples (half of total fruit) apples = total_fruit // 2 # Calculate number of pies (3 apples per pie) pies = apples // 3 return pies # Input and output for two test cases # Test Case 1 total_fruit_1 = 4 # Input: 4 print(calculate_pies(total_fruit_1)) # Expected Output: 0 # Test Case 2 total_fruit_2 = 12 # Input: 12 print(calculate_pies(total_fruit_2)) # Expected Output: 2
15th Sep 2024, 10:35 AM
Kavya Saxena
Kavya Saxena - avatar