What am I doing wrong with this code. Please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What am I doing wrong with this code. Please help

I have just finished first module (Basic concepts). I was trying to put to practice a few of the things that I learnt. I am trying to make a small program to help someone who is trying to find help with percentages. The code I have written is as follows: print(""" To work out the percentage increase or decrease, add on or subtract the percentage you have found. EXAMPLE ONE A calculator is priced at $12 but there is a 25 percent discount. tow work out how much it will cost:""") int(input("Enter percentage"))/int(input("Enter Hundred as number"))*int(input("Enter price")) print(""" Now that you have the how much to deduce from the price:""") int(input("Enter Orignal price"))-int(input("Enter deduction")) What am I doing wrong. Thanks in advance.

16th Jan 2020, 5:25 PM
abdi
2 Answers
+ 4
Here is also a solution if you like: reg_ = int(input('Enter regular price: ')) ded_ = int(input('Enter deduction in %: ')) red_ = reg_ / 100 * ded_ print(f'Reduction is: {red_:.2f}') print(f'New price with {ded_:.2f}% deduction is {(reg_ - red_):.2f}')
16th Jan 2020, 7:25 PM
Lothar
Lothar - avatar
+ 1
I started fixing it for you. Now you continue. Enter for example 25 100 both on separate lines and you will get the deduction 50. In playground all inputs must be introduced before on separate lines and then hit submit. https://code.sololearn.com/c2cJL6tEY5E1/?ref=app
16th Jan 2020, 6:06 PM
Mihai Apostol
Mihai Apostol - avatar