{"id":186,"date":"2025-10-17T19:35:39","date_gmt":"2025-10-17T19:35:39","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/h_francois\/?p=186"},"modified":"2025-10-17T19:39:05","modified_gmt":"2025-10-17T19:39:05","slug":"friday-10-17-2025","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/h_francois\/2025\/10\/17\/friday-10-17-2025\/","title":{"rendered":"Friday 10\/17\/2025"},"content":{"rendered":"\n<p>today i made a small project of hangman that took 20mins using python on vscode i will be adding code and pictures below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>words = (\"apple\", \"orange\", \"banana\", \"coconut\", \"pineapple\")<\/code><\/pre>\n\n\n\n<p>the code above was the list i used for words(cheat sheet)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndef display_man(wrong_guesses):\n    print(\"************\")\n    for line in hangman_art&#91;wrong_guesses]:\n        print(line)\n    print(\"************\")\n\ndef display_hint(hint):\n    print(\"\".join(hint))\n\ndef display_answer(answer):\n    print(\"\".join(answer))\n\ndef main():\n    answer = random.choice(words)\n    hint = &#91;\"_\"] * len(answer)\n    wrong_guesses = 0\n    guessed_letters = set()\n    is_running = True<\/code><\/pre>\n\n\n\n<p>the functions i used in the code main was the most important one<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while is_running:\n        display_man(wrong_guesses)\n        display_hint(hint)\n        guess = input(\"enter a letter: \").lower()\n\n        if len(guess) != 1 or not guess.isalpha():\n            print(\"Invalid input\")\n            continue\n\n        if guess in guessed_letters:\n            print(f\"{guess} is already guessed\")\n            continue\n\n        guessed_letters.add(guess)\n\n        if guess in answer:\n            for i in range(len(answer)):\n                if answer &#91;i] == guess:\n                    hint&#91;i] = guess\n\n        else:\n            wrong_guesses += 1\n\n        if \"_\" not in hint:\n            display_man(wrong_guesses)\n            display_answer(answer)\n            print(\"YOU WIN!\")\n            is_running = False\n        elif wrong_guesses &gt;=len(hangman_art) - 1:\n            display_man(wrong_guesses)\n            display_answer(answer)\n            print(\"YOU LOSE!\")\n            is_running = False<\/code><\/pre>\n\n\n\n<p>and finally the while i used to make everything run the end \ud83d\ude42<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"326\" src=\"https:\/\/theroyalscode.com\/students\/h_francois\/wp-content\/uploads\/2025\/10\/hang.png\" alt=\"\" class=\"wp-image-189\" srcset=\"https:\/\/theroyalscode.com\/students\/h_francois\/wp-content\/uploads\/2025\/10\/hang.png 465w, https:\/\/theroyalscode.com\/students\/h_francois\/wp-content\/uploads\/2025\/10\/hang-300x210.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"593\" height=\"328\" src=\"https:\/\/theroyalscode.com\/students\/h_francois\/wp-content\/uploads\/2025\/10\/hang2.png\" alt=\"\" class=\"wp-image-190\" srcset=\"https:\/\/theroyalscode.com\/students\/h_francois\/wp-content\/uploads\/2025\/10\/hang2.png 593w, https:\/\/theroyalscode.com\/students\/h_francois\/wp-content\/uploads\/2025\/10\/hang2-300x166.png 300w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>today i made a small project of hangman that took 20mins using python on vscode i will be adding code and pictures below the code above was the list i used for words(cheat sheet) the functions i used in the code main was the most important one and finally the while i used to make [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/posts\/186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/comments?post=186"}],"version-history":[{"count":3,"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/posts\/186\/revisions"}],"predecessor-version":[{"id":191,"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/posts\/186\/revisions\/191"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/media?parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/categories?post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_francois\/wp-json\/wp\/v2\/tags?post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}