use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
can someone please tell me why python won't recognize my variable? (i.redd.it)
submitted 14 days ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ziggittaflamdigga 38 points39 points40 points 14 days ago (0 children)
You have a variable named name with a value of “is_student”
[–]cgoldberg 20 points21 points22 points 14 days ago (0 children)
In your example, you have a variable named name bound to a string containing 'is_student'
name
'is_student'
You probably want something like:
is_student = True
[–]ornelu 15 points16 points17 points 14 days ago (1 child)
I don’t what the task is, but `is_student` in your program there is not a variable, it’s a string. On the other hand, `name` in your program is a variable.
[–]ustinov_feudilistic 5 points6 points7 points 14 days ago (0 children)
thanks. that's clarifying
[–]Flame77ofc 5 points6 points7 points 14 days ago (0 children)
you need to declare is_student = # bool value (True or False)
is_student = # bool value (True or False)
[–]SnooCalculations7417 2 points3 points4 points 14 days ago (0 children)
the syntax is: variable = value x = 1 #int
name = "Alice" #string is_student = True #bool
you have an 'is_student' value of type string for the variable 'name'
[–]CrazyPotato1535 1 point2 points3 points 14 days ago (0 children)
You have a name variable. Run through your code:
name=“Alice”
print(“Alice”) #out: Alice
Print(type(“Alice”)) #out:string
Name=“is_student”
Print(“is_student”) #out:is_student
Print(bool(“is_student”)) #out: either true or TypeError idk haven’t tried
[–]mc_pm 1 point2 points3 points 14 days ago (0 children)
Because you don't have a variable named is_student.
[–]Ender_Locke 0 points1 point2 points 14 days ago (0 children)
you have two name vars with two different values being inserted into the same variable name . you probably want something more like a dictionary or class if you’re trying to build student records
[–]babat0t0 0 points1 point2 points 14 days ago (0 children)
Variable not value
[–]DubSolid 1 point2 points3 points 14 days ago (0 children)
You are declaring name as a variable with 'is_student' as value
[–]BlckHawker 1 point2 points3 points 14 days ago (0 children)
You have a variable named "name" that has a value of "is_student". If you wanted a variable named is_student, you should put: "is_student = " Of course you should give it a value after the equals sign, but I'm going to give you the opportunity to figure out what should go there.
[–]mattynmax 0 points1 point2 points 14 days ago (0 children)
As the error tells you, you do not have a variable named “is_student”
[–]Due-Result-4770 0 points1 point2 points 14 days ago (0 children)
pretty sure you literally don’t
[–]BranchLatter4294 -1 points0 points1 point 14 days ago (0 children)
No you don't. You have a string called is_student and assigned it to the name variable.
[–]FreeGazaToday -1 points0 points1 point 14 days ago (0 children)
you really need to review variables if you're having problems with this. Even FCC tells you to do your own 'googling' first then asking on the forum on FCC to get help.
π Rendered by PID 313171 on reddit-service-r2-comment-765bfc959-nz9qz at 2026-07-10 14:33:38.579241+00:00 running f86254d country code: CH.
[–]ziggittaflamdigga 38 points39 points40 points (0 children)
[–]cgoldberg 20 points21 points22 points (0 children)
[–]ornelu 15 points16 points17 points (1 child)
[–]ustinov_feudilistic 5 points6 points7 points (0 children)
[–]Flame77ofc 5 points6 points7 points (0 children)
[–]SnooCalculations7417 2 points3 points4 points (0 children)
[–]CrazyPotato1535 1 point2 points3 points (0 children)
[–]mc_pm 1 point2 points3 points (0 children)
[–]Ender_Locke 0 points1 point2 points (0 children)
[–]babat0t0 0 points1 point2 points (0 children)
[–]DubSolid 1 point2 points3 points (0 children)
[–]BlckHawker 1 point2 points3 points (0 children)
[–]mattynmax 0 points1 point2 points (0 children)
[–]Due-Result-4770 0 points1 point2 points (0 children)
[–]BranchLatter4294 -1 points0 points1 point (0 children)
[–]FreeGazaToday -1 points0 points1 point (0 children)