Wait....you're probably using a python 3.x version so you have to put parenthesis around things you want to print:
print (subtotal)
User Profile
Collapse
-
-
When you put quotes or single quotes around the numbers or words, it reads them as a string of letters, not numbers. Remove the quotes.
So...Code:shirts=12.99 amount=input("How many shirts would you like to purchase?") subtotal= shirts * amount * 0.20 percentage= shirts * amount * 0.20 total= subtotal - percentage print subtotal, percentage, totalLeave a comment:
-
I need help with a loop that replaces a number in a sentence
Hi,
If I have a sentence like this:
"I now have a total of % yellow bananas!"
but I need it to change the number 2 to a 3, print, then a 4, print, etc until it reaches a set number like 10, how can I go about that?
...Code:sentence = "I now have a total of % yellow bananas!" for i in range(2,11): print sentence %i -
It's about a race condition and it should print out '1000' every time but it doesn't always. I tried to change Executors.newFi xedThreadPool(1 00); to match the Thread.sleep(50 0); so the times are the same but that didn't seem to fix it.Leave a comment:
-
-
Whats wrong with this loop code?
Sometimes it works, sometimes it doesn't but I can't find the bug:
...Code:package Loop.Test; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TheLoopTest { private final ExecutorService executorService = Executors.newFixedThreadPool(100); private static final int MAX = 1000; private int zeroToTop
No activity results to display
Show More
Leave a comment: