why am I getting this error with this code?
:print('Women: {:.2f} calories'.format('calories_woman'))
THIS IS THE ERROR I AM GETTING
:ValueError: Unknown format code 'f' for object of type 'str'
Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thank You So Much.
Here is the issue.
You are using .f for the str type. here 'calories_woman' is string , Hence format should be s not the f.
Something like below
But if you are trying to print value instread of string. You have to use variable of double type like below
Get Answers For Free
Most questions answered within 1 hours.