Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Set bool variable
#1
I can't believe I'm having so much trouble creating a boolean variable! I just want to tell my program to set a boolean to true if two strings match each other:
word = "dink"

bool("guessStringMatches")#error: invalid syntax
guessStringMatches = false#NameError: name 'false' is not defined

guess = str(input("What's the word you dink head?"))

if guess == word:
print("you guessed the word correctly.")
guessStringMatches = true
 
Reply
#2
Quote:guessStringMatches = false#NameError: name 'false' is not defined
its False and True

you also need to make a new thread as this has nothing to do with the previous
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Split string using variable found in a list japo85 2 1,238 Jul-11-2022, 08:52 AM
Last Post: japo85
  Bool Object is not Subscriptable quest 1 4,086 May-02-2021, 11:12 AM
Last Post: Yoriz
  [split] Creating a variable as a function DPaul 23 6,508 Sep-07-2020, 05:20 PM
Last Post: DPaul
  ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item() Rejoice 6 3,190 Aug-25-2020, 03:50 PM
Last Post: Rejoice
  bool b = (num == 100) this doesn't work? MelonMusk 2 1,957 Jun-12-2020, 02:18 AM
Last Post: bowlofred
  [split] script: remove all "carriage return" from my json variable pete 2 2,744 May-05-2020, 03:22 PM
Last Post: deanhystad
  ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item() bongielondy 2 14,076 Nov-27-2019, 03:25 PM
Last Post: ThomasL
  bool PreservedKillich 6 3,203 Aug-01-2018, 03:09 AM
Last Post: Skaperen
  Replacing variable in a split string and write new file python MyCode 1 3,527 Oct-30-2017, 05:20 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020