I am using python to work out how many children would be born in 5 years if a child was born every 7 seconds. The problem is on my last line. How do I get a variable to work when I'm printing …
This is just a snippet of my code:
print("Total score for %s is %s ", name, score)
But I want it to print out:
"Total score for (name) is (score)"
where name is a variable in a list and score …
There are several ways to write to stderr:
# Note: this first one does not work in Python 3
print >> sys.stderr, "spam"
sys.stderr.write("spam\n")
os.write(2, b"spam\n")
from __future__ import print_function
print("spam", …