I have same question on task #7, #10, and #13. I saw that we can replace the str() function in a print string to format() function. Like here,This FAQ. However, I tried it on these three tasks and none of them work.(It works when I was doing the same section as the FAQ) What did I do wrong?
For example:
train_force = get_force(22680,10)
print(“The GE train supplies {train} Newtons of force.”). format(train=train_force)
or
bomb_mass = 1
bomb_energy = get_energy(bomb_mass)
print(“A 1kg bomb supplies {bomb_energy} joules.”). format(bomb_energy=bomb_energy)
They all got error something like this one:
Traceback (most recent call last):
File “script.py”, line 26, in
print(“A 1kg bomb supplies {bomb_energy} joules.”). format(bomb_energy=bomb_energy)
AttributeError: ‘NoneType’ object has no attribute ‘format’