+ 2

Easter eggs (Phyton) HELPPPPP

Task: If you know the total number of eggs that were hidden and the amount in both of your baskets. Evaluate whether it is time to eat candy or keep hunting for more eggs. Input Format: Three integer values. The first represents the total number of eggs, the second, the amount in your basket, and lastly the amount that your friend has found. Output Format: A string that says 'Keep Hunting' if there are still eggs out there or 'Candy Time' if you found all the eggs. Sample Input: 100 40 60 Sample Output: Candy Time Well, when I run the code sololearn says that there's a mistake. I can't find it, please helppp 😔 number_eggs = int(input()) my_basket = int(input()) friend_basket = int(input()) if not (my_basket+friend_basket == number_eggs): if my_basket <= friend_basket: print('Keep Hunting') else: print('Candy Time') else: print('Candy Time')

6th Mar 2024, 12:26 AM
RinKM25
RinKM25 - avatar
5 Antworten
+ 3
The condition if my_basket <= friend_basket: is wrong..., your eggs can be more than your friend's eggs and you would still have to keep hunting if the total eggs is not equal to the sum.
6th Mar 2024, 12:41 AM
Bob_Li
Bob_Li - avatar
0
Mohamed Beder Oumar Bob_Li thanks for the help!
6th Mar 2024, 12:53 AM
RinKM25
RinKM25 - avatar
0
Can I help me please I'm beginner for the Python and I love python but I don't know coding
7th Mar 2024, 3:54 PM
Kevinn Moncoeur
Kevinn Moncoeur - avatar
0
Kevinn Moncoeur First, watch videos on yt about programming logic and its foundations. Then you can start with Introduction to Phyton. Once you finish do Phyton intermediate and if you want you can do Phyton developer at the same time (I recommend you to watch a list of videos on yt about how to program in phyton to improve your knowledge). Also, it is important to do coding exercises, no matter if it is easy or hard (youtube and sololearn community practice).
7th Mar 2024, 11:55 PM
RinKM25
RinKM25 - avatar
0
Kevinn Moncoeur I think you should also improve your programming logic by making flowcharts, and the rest will flow by itself. I would also say to focus on a single language so that you don't get tangled up.
7th Mar 2024, 11:59 PM
RinKM25
RinKM25 - avatar