Pls help me understand what’s wrong with my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pls help me understand what’s wrong with my code

paints = int(input()) x= ((paints*5 + 40)+((paints*5+40)//10)) import math math.ceil(x) print (x) Here’s my code and the task will be in the comments. I can’t pass two hidden tests so I don’t know what’s wrong

26th Mar 2021, 5:00 PM
Маргарита Охотникова
Маргарита Охотникова - avatar
6 Answers
+ 2
Because you use // to cut the number lower than itself while this test asks you to round up I will attach the code to you in a few minutes
26th Mar 2021, 5:16 PM
MohammadMahdi
MohammadMahdi - avatar
+ 2
to fix your original code, lose the hard division as Mohammad mentioned. set x equal to math.ceil(x) print out the int() version of x
26th Mar 2021, 5:21 PM
Slick
Slick - avatar
26th Mar 2021, 5:19 PM
MohammadMahdi
MohammadMahdi - avatar
+ 1
oh now i see! I probably should have thought more. thanks a lot 🙏🏼🙏🏼
26th Mar 2021, 5:21 PM
Маргарита Охотникова
Маргарита Охотникова - avatar
+ 1
thanks Slick! anyway, it feels good to understand both ways to solve this task. thanks a lot 🙏🏼
26th Mar 2021, 5:23 PM
Маргарита Охотникова
Маргарита Охотникова - avatar
0
You are getting ready to paint a piece of art. The canvas and brushes that you want to use will cost 40.00. Each color of paint that you buy is an additional 5.00. Determine how much money you will need based on the number of colors that you want to buy if tax at this store is 10%. Task Given the total number of colors of paint that you need, calculate and output the total cost of your project rounded up to the nearest whole number. Input Format An integer that represents the number of colors that you want to purchase for your project. Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. Sample Input 10 Sample Output 99
26th Mar 2021, 5:01 PM
Маргарита Охотникова
Маргарита Охотникова - avatar