<pre>''' can anyone please explain me these two line of codes and how do they work''' '''letter = random.choice[position] is this a list now? and display[position] = letter can anyone please explain me how is these two code working in details please i didnt understad how display which is a list now is also a position is this position a list now?
import random random_list = ["Apples", "Oranges", "Pea", "Cherries"] random_choice = random.choice(random_list) display = [] answer = print("The word is",random_choice) new_word = len(random_choice) guess = input("Please enter random characters : \n") for i in range(0, new_word): display += "_" print(display) for position in range(0, new_word): letter = random_choice[position] if letter == guess: display[position] = letter print(display)
position
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)