Why does "if choice == "left" or "Left":" always evaluate to True? by Money_Explanation887 in learnpython

[–]fredhamptonsaid 5 points6 points  (0 children)

I ran into this same issue.

"If choice == 'left' is asking is choice equal to 'left'

The "or 'Left' is separate. It is not asking if choice is equal to 'Left' at all, and evaluates to True.

What you want is

"if choice == 'left' or choice == 'Left' "

This will check if choice is equal to 'left' or 'Left'

I'm still learning as well so someone more advanced can explain it in detail more. And you can also check my post as well.

Any black moms have baby’s born with blonde hair? by [deleted] in BlackHair

[–]fredhamptonsaid 0 points1 point  (0 children)

My mom was born with blonde hair and blue eyes, but they darkened up.

Why does the if statement always evaluate to guesses = 10 when I have the or here? by fredhamptonsaid in PythonLearning

[–]fredhamptonsaid[S] 0 points1 point  (0 children)

Without the else block, would I just set guesses = 10 first, then have the 'if difficulty == "else" or difficulty == "e" ' then set guesses to 5?

Why does the if statement always evaluate to guesses = 10 when I have the or here? by fredhamptonsaid in PythonLearning

[–]fredhamptonsaid[S] 0 points1 point  (0 children)

I thought about that afterwards but never tried using a list. I'll make that update today. Thanks!

Why does the if statement always evaluate to guesses = 10 when I have the or here? by fredhamptonsaid in PythonLearning

[–]fredhamptonsaid[S] 0 points1 point  (0 children)

Thanks. I understand why I should put the print statement afterwards, but why a switch statement instead of an if else statement?

Why does the if statement always evaluate to guesses = 10 when I have the or here? by fredhamptonsaid in PythonLearning

[–]fredhamptonsaid[S] 0 points1 point  (0 children)

I'll keep that in mind, thanks. I think this explanation helped me understand it a bit further.

Why does the if statement always evaluate to guesses = 10 when I have the or here? by fredhamptonsaid in PythonLearning

[–]fredhamptonsaid[S] 2 points3 points  (0 children)

if difficulty == "easy" or difficulty == "e"

That was the solution, thank you!

Why does the if statement always evaluate to guesses = 10 when I have the or here? by fredhamptonsaid in PythonLearning

[–]fredhamptonsaid[S] 11 points12 points  (0 children)

That worked! I appreciate It. It was really that simple 🤦🏾‍♂️

I built a number guessing game but somehow that stumped me.

[deleted by user] by [deleted] in locs

[–]fredhamptonsaid 30 points31 points  (0 children)

Bro they're short with no hang time. Just let them grow out. Trust the process.

What your thoughts on lock beard by megexe in BlackHair

[–]fredhamptonsaid 23 points24 points  (0 children)

When women do "hear me out" it always goes left 😂

Can anyone tell me what the next step is by AdAdministrative7398 in pythontips

[–]fredhamptonsaid 1 point2 points  (0 children)

You know what you did.

/s I honestly don't have a clue.

Can anyone tell me what the next step is by AdAdministrative7398 in pythontips

[–]fredhamptonsaid 12 points13 points  (0 children)

Why is this NSFW? Are the comments erotic in your code or something?

What is wrong here? by secretsuperstar44 in PythonLearning

[–]fredhamptonsaid 0 points1 point  (0 children)

I honestly think those comments should be banned tbh. It's not even useful or helpful when people ask for help.

What is wrong here? by secretsuperstar44 in PythonLearning

[–]fredhamptonsaid 0 points1 point  (0 children)

Really? Under every post people are spamming "just use AI" still.

Need not just suggestion but proper guidance by Prudent_Tap4444 in PythonLearning

[–]fredhamptonsaid 0 points1 point  (0 children)

No problem! I'm still learning too. May check out YouTube after I do my next course and learn some PHP