0
Could anyone please tell me how to fix the error in my code???The problem is "Duct Tape" in code coach.
height=int(input()) width=int(input()) area=round((height*width)*2,-1) print(area//10)
23 Réponses
+ 4
Do not use round
use ceil
import math
print(math.ceil(area/10))
+ 5
Vaibhav Pandey I understand what task you are talking about, and the fact that you are using rounding incorrectly, but the most important thing is that you are solving the problem incorrectly.
+ 4
Vaibhav Pandey There are many ways to solve, for example, by using a cycle, by comparing the area of the door with the area of the roll or by writing the rounding function yourself. It's all in your hands, go for it... 🖐️😎
+ 3
A͢J it worked bro thanks for the help!
+ 3
Ah, ok. I got it now. Didn’t understand the question at first. Sorry my bad bro.
+ 2
Solo bro 🤣😅🤣😅 i solved it but thanks for the help ☺️
+ 2
Vaibhav Pandey successful coding! 🖐️😎
+ 2
Vaibhav Pandey Do not stop there, try to solve this task without importing "math"... 😎
+ 2
Alex bro i did it but it rounds 24 to 20 but I need 30 that's why I did it
0
First of all, why do you even need the round function? Height and weight are both integers and their multiplication will result in another integer. Also, the second argument should be set to something like 0, 1, 2, ,…, if you want that number of floating point numbers. Otherwise, using negative values like -1 will eliminate digits from the actual result. Set that to 0 and this should solve the issue. Hope that helped.
0
First, think carefully.
What do need to do to find the number of rolls?
0
Solo yeah but how there's no way rounding works like that
0
I agree with Solo. I know you that you got your answer, but try to run it without the line that has the round() function and you’ll see that it returns the same result.
0
Alex No problem bro!
0
sprint(VFL) +(4*5)/
0
It's working code:
h=int(input())
w=int(input())
roll=60*2/12
sq=h*w*2
if sq%roll==0:
print(int(sq//roll))
else:
print(int(sq//roll)+1)
0
Galina Van, yes, this is perhaps the easiest way to solve this problem without using rounding.
The only note is that "//" is an integer division operator, so the int() function is not needed here... 😎
0
Solo, за счёт операции деления получается вещественное число, а в ответе нужно целое. Я это проверила в тренажёре, поэтому функция int() не лишняя.
0
Galina Van , this is because you made "roll" a fractional number... 😎