Hi, welcome back.
In this lecture, we will complete hangmen game project, which we thought at last lecture.
So let's begin after we bring the game name and the word chosen by the Python random module.
Now we will create a new list called Result, composed of underscores.
And after the game starts, it will replace those six and those goals by the correct letters of the
correct word chosen by random module to be guessed by the player's result equal to empty square brackets.
Then we will iterate over the player inputs as the following four underscore between two single codes
and range word letters and make all the letters of the word chosen by random module and lowercase by
adding that lower method to the random choice method that will make it easy to be matched with player
inputs.
Then inside the for loop we will add result blasts equal between two single code underscore to add six
and the scores inside the result less to be replaced by the letter or the correct letters guessed by
the player.
Then, if the game is over using while loop as the following while not game over per game underscore
over column.
Inside the while loop we will add the code of the game events that happened when the game end.
So all the upcoming code will be inside the while loop to be iterate until the game end.
So user underscore getting equal input between two parentheses single codes gets a letter column, its
close the single codes close the parentheses.
This is the message that will be shown to the player after he gets a letter and aimbot it.
So it will be entered to be shown on the screen.
Now we will inform the player about the letters or the letter.
They have guessed by using every statement as a follow.
But before we do that, we will add the extra number ten step, which is iterate over the user aimbot
to keep the game running until the game is over.
So if the user underscore guessing end result column inside the statement brain between two parentheses
F for main function for the string and two single codes.
The letter you have guessed is between two brackets.
User underscore getting these two lines of codes.
Well, print to the letters that the players will guess.
Then check if the guest letter by the player is right or wrong and added to the result list using for
loop with the position Caywood plus range function as the following for position and range.
Warde underscore letters between two parentheses of the range function and inside this for Loop we will
add the following line letter equal guessing underscore word between two square brackets position and
if the letters equal user underscore getting resolved between two square brackets position equal letters,
then Brent is a message of wrong letter.
If the player choose a wrong letters and the brand is a message of losing the game, if the player lose
all their sexy tries, so tries minus equal one.
After tries equals zero, which means a game is over.
Or tries all the tries or attempt by the players, print the message of the game losing and the following
print.
Between two parentheses game over.
You lose the game, try again later.
So game over equal to also.
Then join all the correct letters which replace the underscores in the results list as the following
brand between two parentheses F and inside the two single codes, we add to curly brackets as the following.
Then inside the two curly brackets, we will add our joint function as the following two double codes
that join between two parentheses rizzle.
Then the underscore between two single codes not end result column game underscore over equal true and
the Brent between two parentheses and two single codes.
You are a winner comma.
Congratulations.
Then make sure to Brent every shape of every tribe of the tribes of the players from hangmen underscore
life.
So we will import these shapes from the hangmen, underscore life dobi or module as the following from
hangmen, underscore life and bought lives.
And Brent, between two parentheses lives and between two square brackets, tries so drivers of lives
will be presented as shapes.
Then we will run the second part of our program.
We get invalid or syntax error and the line number 13.
So we will add line numbers by clicking on view then and we'll drop down.
We will choose the line numbers.
We add wrong words.
So we will remove it, then run the code again, which is then after F F user, not F the user.
So we get another error, which is due to single codes in the for loop headline number five.
So we will remove those two single codes and run our code again and we get another error and the line
number thirty two ends.
For me it was joint training function.
So we will replace the two single codes of the Fermi's function with the two double codes and run our
code again and we will get another syntax error.
We add one equilibrated, but if we want to add polin overwritten, we add two equal to double equilibrated
to be polin and check if true or not, and it will run successfully.
So I will try to play the game to test at the losing and winning phases as the following.
At this point, we reached the end of this lecture.
Hope you enjoyed this lecture and get all of that.
Thank us for being here.
And thanks for watching.
See you next, Viju.