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)

19th Mar 2023, 9:16 AM
Vaibhav Pandey
23 Réponses
+ 4
Do not use round use ceil import math print(math.ceil(area/10))
19th Mar 2023, 9:46 AM
A͢J
A͢J - avatar
+ 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.
19th Mar 2023, 11:58 AM
Solo
Solo - avatar
+ 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... 🖐️😎
19th Mar 2023, 12:34 PM
Solo
Solo - avatar
+ 3
A͢J it worked bro thanks for the help!
19th Mar 2023, 10:32 AM
Vaibhav Pandey
+ 3
Ah, ok. I got it now. Didn’t understand the question at first. Sorry my bad bro.
19th Mar 2023, 12:24 PM
Alex
Alex - avatar
+ 2
Solo bro 🤣😅🤣😅 i solved it but thanks for the help ☺️
19th Mar 2023, 12:00 PM
Vaibhav Pandey
+ 2
Vaibhav Pandey successful coding! 🖐️😎
19th Mar 2023, 12:02 PM
Solo
Solo - avatar
+ 2
Vaibhav Pandey Do not stop there, try to solve this task without importing "math"... 😎
19th Mar 2023, 12:18 PM
Solo
Solo - avatar
+ 2
Alex bro i did it but it rounds 24 to 20 but I need 30 that's why I did it
19th Mar 2023, 12:23 PM
Vaibhav Pandey
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.
19th Mar 2023, 9:47 AM
Alex
Alex - avatar
0
First, think carefully. What do need to do to find the number of rolls?
19th Mar 2023, 10:16 AM
Solo
Solo - avatar
0
Alex Solo The problem is in the code coach named "Duct Tape" bro as i mentioned in the question.You can see the explanation there bro.
19th Mar 2023, 10:30 AM
Vaibhav Pandey
0
Solo yeah but how there's no way rounding works like that
19th Mar 2023, 12:20 PM
Vaibhav Pandey
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.
19th Mar 2023, 12:21 PM
Alex
Alex - avatar
0
Alex No problem bro!
19th Mar 2023, 12:26 PM
Vaibhav Pandey
0
sprint(VFL) +(4*5)/
21st Mar 2023, 4:25 AM
José Hernandez
José Hernandez - avatar
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)
21st Mar 2023, 5:21 AM
Galina Van
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... 😎
21st Mar 2023, 10:31 AM
Solo
Solo - avatar
0
Solo, за счёт операции деления получается вещественное число, а в ответе нужно целое. Я это проверила в тренажёре, поэтому функция int() не лишняя.
21st Mar 2023, 11:30 AM
Galina Van
0
Galina Van , this is because you made "roll" a fractional number... 😎
21st Mar 2023, 3:03 PM
Solo
Solo - avatar