Closed pete911 closed 8 years ago
I don't understand specifically what you want me to do
replace all print function where you use "+" with "".format() so it is easier to read (looks like you have only 2 occurrences).
plus I've tried it, and it doesn't work using pycharm
file 19_bmi.py, line 12. Replace 'print("your BMI is ",BMI)' with 'print("your BMI is {0}.".format(BMI))'
there's another occurrence in the other file, replace that one as well.
ok
'print("your BMI is {0}.".format(BMI))' done!
strings have 'in built' function format. Format function takes variable number (any number) of arguments and replaces '{x}' (where x is index of the argument) with the supplied argument.
* Example: *
"hello {0}, are you OK {0}?".format("Naomi")
Here you supplied one argument to the format function you call on string. Run it and see what it does.String can be saved in a veriable as well:
This will display
today is Friday, 10 o'clock
, because we use {1} - index one is second argument and then {0}.