online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import random def hangman(): word_list = ["python", "java", "kotlin", "javascript"] chosen_word = random.choice(word_list) word_length = len(chosen_word) attempts = 6 guessed_letters = [] hidden_word = list("-" * word_length) print("H A N G M A N\n") while attempts > 0: print("".join(hidden_word)) guess = input("Input a letter: ") if guess in guessed_letters: print("You already typed this letter") elif len(guess) != 1: print("You should input a single letter") elif not guess.isalpha() or guess.isupper(): print("It is not an ASCII lowercase letter") elif guess in chosen_word: for i in range(word_length): if chosen_word[i] == guess: hidden_word[i] = guess guessed_letters.append(guess) else: print("No such letter in the word") guessed_letters.append(guess) attempts -= 1 if "-" not in hidden_word: print("\nYou guessed the word!") print("You survived!") return print() print("You are hanged!") return hangman()

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue