Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hangman Help.
#3
Actually, you want to remove this line:

guess = guess.upper()
This upper cases the letter you guessed, so if you guessed 'a', it becomes 'A'. But if you look at possibleAnswers at the beginning of the code, it's all in lower case. So you're constantly trying to match upper case characters to lower case. It would actually make more sense to replace that line with:

guess = guess.lower()
That way, even if you guess 'A', it will match against 'a', which is what might be in the answer.

BTW, if that really is the code you copied from the tutorial you are learning from, find a new tutorial. That's really bad code. Oh, and count is the number of correct answers, so what the code actually does is let you guess until you have all the letters. You can't lose.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Hangman Help. - by 2skywalkers - Jun-24-2018, 09:21 PM
RE: Hangman Help. - by Larz60+ - Jun-24-2018, 09:47 PM
RE: Hangman Help. - by ichabod801 - Jun-25-2018, 03:22 AM
RE: Hangman Help. - by 2skywalkers - Jun-25-2018, 08:36 PM
RE: Hangman Help. - by ichabod801 - Jun-26-2018, 02:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Hangman metro17 4 3,084 Sep-18-2019, 10:59 AM
Last Post: perfringo
  Trouble coding hangman Tay 1 2,391 Mar-28-2019, 01:57 AM
Last Post: ichabod801
  Hangman code problem KrakowKid 1 2,436 Feb-25-2019, 06:29 PM
Last Post: ichabod801
  Python hangman help A1395 11 7,329 Feb-13-2019, 04:24 PM
Last Post: ichabod801
  Hangman 2skywalkers 3 79,752 Oct-19-2018, 01:49 PM
Last Post: ichabod801
  Python Hangman Replacing "_" with letters. 2skywalkers 6 12,239 Jun-25-2018, 12:01 PM
Last Post: gruntfutuk
  Simple Hangman Game Issue andrew95 2 4,390 Apr-02-2018, 02:24 PM
Last Post: andrew95
  Designing Hangman game spacetimeguy 2 5,184 Feb-02-2018, 08:55 PM
Last Post: spacetimeguy
  TKinter Hangman Game Bumble 1 20,725 Jul-19-2017, 06:56 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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