Python Forum
Python Hangman Replacing "_" with letters.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Hangman Replacing "_" with letters.
#1
I have been working my way through projects on Python and now I want to start on hangman. I have not started the code yet because of an issue I am having trouble finding a solution. I want a hangman game where there is a list of random words and a random word is chosen. I want the person to be able to guess a letter and then replace the "_" with that letter at the correct index. For example: The word is "apple" so "_____" but if you guess a then "a____":
I would also like to be able to place a letter in all the times it is in the word like "p" is in apple twice so if guess is "p" it would be "_pp__". I want to try and do all the rest of code myself I just would like to know how to do this small part so I can then apply it.
Reply


Messages In This Thread
Python Hangman Replacing "_" with letters. - by 2skywalkers - Jun-24-2018, 12:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  eliminating letters when typed in python window deebo 0 1,753 Jan-05-2021, 09:26 AM
Last Post: deebo
  Replacing a words' letters in a string cananb 2 3,496 Dec-01-2020, 06:33 PM
Last Post: perfringo
  Python Hangman Game - Multiple Letters Problem t0rn 4 4,738 Jun-05-2020, 11:27 AM
Last Post: t0rn
  Hangman metro17 4 3,045 Sep-18-2019, 10:59 AM
Last Post: perfringo
  Trouble coding hangman Tay 1 2,381 Mar-28-2019, 01:57 AM
Last Post: ichabod801
  Hangman code problem KrakowKid 1 2,414 Feb-25-2019, 06:29 PM
Last Post: ichabod801
  Python hangman help A1395 11 7,258 Feb-13-2019, 04:24 PM
Last Post: ichabod801
  Replacing all letters in a string apart from the first letter in each word Carbonix 9 4,968 Jan-17-2019, 09:29 AM
Last Post: buran
  Hangman 2skywalkers 3 74,214 Oct-19-2018, 01:49 PM
Last Post: ichabod801
  Replacing letters on a string via location Owenix 2 2,485 Sep-16-2018, 10:59 AM
Last Post: gruntfutuk

Forum Jump:

User Panel Messages

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