Hi, everybody.
I tried using string formatting methods with "f".
bro_name = "firstname"
bro_surname = "surname"
bro_age = "six"
bro_info = f"{firstname} {surname.upper()}, {six}."
print(bro_info)
But I'm new to Python programming and don't understand why something went wrong.
Traceback (most recent call last):
File "C:/Users/xxx_/PycharmProjects/anaisproject/string.py", line 25, in module
bro_info = f"{firstname} {surname.upper()}, {six}."
NameError: name 'firstname' is not defined
Thank you in advance for your advice.
firstname
and surname
are the strings that are placed in variables bro_firstname
and bro_surname
. You was writing non-existant variable names - prepend bro_
to them, because you named the variables like that.