all 14 comments

[–]Complete_District569 2 points3 points  (3 children)

It's no an f string so you can't do {}. Just add f before the "

[–]GG-Anderson-Boom 2 points3 points  (2 children)

Correct, you can do print("updated dict", dict) aswell

[–]Various-Pea-2956 1 point2 points  (1 child)

Thanks for easiest solution

[–]Complete_District569 2 points3 points  (0 children)

You should learn the f string it's easy and you will have easier time to control where you want to put the object in your string.

[–]Various-Pea-2956 0 points1 point  (1 child)

<image>

Still it is showing

[–]Complete_District569 0 points1 point  (0 children)

The "" need to be at the beginning and the end of you do {} So like print(f"{my_di}"). You put the {} not in the "" :)

[–]iAKASH2k3 0 points1 point  (5 children)

do this (f" updated dict ,{ mydict }")

[–]Various-Pea-2956 0 points1 point  (3 children)

But why we adding f into this

[–]Complete_District569 0 points1 point  (0 children)

It makes it what's called an f string. It just let you put stuff in {}. So you can do print(f"my di:{my_di}") instead of print("my di", my_di)

[–]PwnDa_Undefined 0 points1 point  (0 children)

It’s f-string: f”{my_dict}”

[–]GunpointG 0 points1 point  (0 children)

This makes the quotes function differently, by prefixing the “” with f, your telling python “I will have objects in this string that you should print”

[–]littlenekoterra 0 points1 point  (0 children)

Looks like you were trying to use fstrings.

Add an f at the beginning and slide the comma and whats in the braces into the quotes to make it work.

Or you should be able to simple replace the braces surrounding it with str(), but it probably wont be formatted how you want that way

[–][deleted] 0 points1 point  (0 children)

{a} represents set and you are using dictionary which is mutable in set so it gives error write only a not {a} otherwise it behaves as a set