[SOLVED]How to solve coach codes in python? | SoloLearn: Learn to code for FREE!

+8

[SOLVED]How to solve coach codes in python?

Why won't sololearn just accept 55.0 instead of 55? And if I change it to int it will outcome other results wrong

1/27/2021 9:49:37 AM

Swift

23 Answers

New Answer

+12

I believe this works print(round(1.1*(40 + 5 * int(input()))))

+8

Abhay Rik Wittkopp heres my code: paintn = int(input()) cost = 40 + paintn*5 tax = cost /10 price = cost + tax if int(price) != price: print(price) else: print (int(price)) and the link https://sololearn.com/coach/22/?ref=app

+7

Abhay I think that 7 is for experimental and testing the code. If no input is given, it will use 7 instead.

+6

Abhay thanks, wow!

+6

Well done Abhay Struggling with internet connectivity here. Swift may I suggest you review import math math.ceil() Round() in Python can round up or round down, but the challenge specifies rounding up, so ceil() is what you will need. PS: There are other ways to do this also

+5

Abhay do you know what to do?

+5

Swift looking now

+5

Swift question mentions "rounded up" to the nearest whole number. import math paintn = int(input()) cost = 40 + paintn*5 tax = cost /10 price = cost + tax print(math.ceil(price))

+4

wait, if i change codes that have an n.0 end to int will it work? but how should i do that

+4

Shreyash(S&O CODERS) i mean the numbers that have n.0 not the ones that have a decimal value

+4

Shreyash(S&O CODERS) don't post your question under others question , Follow the guidelines , https://www.sololearn.com/Discuss/1316935/?ref=app

+3

Rik Wittkopp I have done this way only and if you don't mind can you show what other ways you are talking about ?

+3

Abhay paintn = int(input() or 7) cost = 40 + paintn*5 tax = cost /10 price = cost + tax print(price) # Avoiding math.ceil() if price %1 !=0: print(price//1 +1)

+3

Rik Wittkopp thank you and why do we have number 7 in input() or 7 tho .

+3

You don't even need if and math.ceil to solve this code coach. 😉 Here's is my code brush= int(input("")) costb=brush*5 total=costb+40 tax=total/10 costt=total+tax print(round(costt)) https://www.sololearn.com/coach/22?ref=app

+2

+2

Swift Your question is not clear. Can you please describe your challenge and attach your attempt. Also please specify which language you are using. Apologies: You have already specified Python

+2

Abhay as Cyan has stated, 7 is a default input used if no user input. I use it for testing and for setting an example

+2

Just use PHP

+1

I have no idea to how to start python