Value error: unknown format /u/Upper-Abroad-5868 Python Education

hello everybody I am back! As some may remember throughout the summer I was learning python throughout a course, but life happens so I’ve been on learning here and there since then till now.

With that said heres my problem:

I tried running my script however these 2 lines of codes are giving me trouble

Terminal:

Traceback (most recent call last):

print(f”—-{keys:10} : {values:.2f} USD$”)

^^^^^^^

ValueError: Unknown format code ‘f’ for object of type ‘str’

for some odd reason It doesnt let me use the .2f format; formats a floating point with 2 numbers to the right

for keys, values in menu.items(): # will print out our menu print(f"----{keys:10} : {values:.2f} USD$") 

submitted by /u/Upper-Abroad-5868
[link] [comments]

​r/learnpython hello everybody I am back! As some may remember throughout the summer I was learning python throughout a course, but life happens so I’ve been on learning here and there since then till now. With that said heres my problem: I tried running my script however these 2 lines of codes are giving me trouble Terminal: Traceback (most recent call last): print(f”—-{keys:10} : {values:.2f} USD$”) ^^^^^^^ ValueError: Unknown format code ‘f’ for object of type ‘str’ for some odd reason It doesnt let me use the .2f format; formats a floating point with 2 numbers to the right for keys, values in menu.items(): # will print out our menu print(f”—-{keys:10} : {values:.2f} USD$”) submitted by /u/Upper-Abroad-5868 [link] [comments] 

hello everybody I am back! As some may remember throughout the summer I was learning python throughout a course, but life happens so I’ve been on learning here and there since then till now.

With that said heres my problem:

I tried running my script however these 2 lines of codes are giving me trouble

Terminal:

Traceback (most recent call last):

print(f”—-{keys:10} : {values:.2f} USD$”)

^^^^^^^

ValueError: Unknown format code ‘f’ for object of type ‘str’

for some odd reason It doesnt let me use the .2f format; formats a floating point with 2 numbers to the right

for keys, values in menu.items(): # will print out our menu print(f"----{keys:10} : {values:.2f} USD$") 

submitted by /u/Upper-Abroad-5868
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *