print "If there was a birth every 7 seconds, there would be: {} births".format(births)
foo = "seven" print("She lives with " + foo + " small men")
# This prints out "John is 23 years old." name = "John" age = 23 print("%s is %d years old." % (name, age)) # note: the letter is based on the datatype. %s = string, %d = decimal
print("If there was a birth every 7 seconds, there would be: {} births".format(births))
name = "Steven" # Using f-strings print(f"Hi, {name}!") # Using format() print("Hi, {}!".format(name))
>>> print("{:d} {:03d} {:>20f}".format(1, 2, 1.1)) 1 002 1.100000 ^^^ 0's padded to 2
>>> print("foo", "bar", "spam") foo bar spam
print("If there was a birth every 7 seconds, there would be: ", births, "births")