![]() |
Problems with printing score of test - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problems with printing score of test (/thread-881.html) |
Problems with printing score of test - JoeLamond - Nov-11-2016 Hello, I have been writing a logic test in my program. When the person answers a question correctly the score goes up by 1 point. At the end I want to print the score but I have been experiencing some problems. When I try this: print(score + "/3")It does not work. When I try this:print(score,"/3")It prints but with a space between the number and the slash. I would like it prints like this: How can I do that?Thankyou, RE: Problems with printing score of test - micseydel - Nov-11-2016 You need score to be interpreted as a string. The easy way to do that is print(str(score) + "/3")but typically you'll want formatting print("{}/3".format(score)) RE: Problems with printing score of test - JoeLamond - Nov-11-2016 Thank you for the help. I will correct my code shortly. |