Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6921071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:13:45+00:00 2026-05-27T10:13:45+00:00

I am writing a program for fun (hang man) and i get incorrrect syntax

  • 0

I am writing a program for fun (hang man) and i get incorrrect syntax on this while loop

while wrong MAX_WRONG and so_far != word:

My whole program is this

import random
HANGMAN=( #this is the Hangman ascii art
"""
_________
   |         |
   |         0
   |        
   |        
   |
   |
 _________
    |         |
    |         0
    |         |
    |        
    |
    |
 _________
    |         |
    |         0
    |        /|\\
    |        
    |
    |
 _________
    |         |
    |         0
    |        /|\\
    |        / \\
    |
    |
""")

MAX_WRONG=len(HANGMAN)-1


WORDS=("OVERUSED","CLAM","BACON","PUCK","TAFFY") #these are the words

word=random.choice(WORDS) #this is teh word that is going to be guessed
so_far="-"*len(word)#where the orrect letteres are viewd
wrong=0
used=[]# the letters incorrectly guessed

while wrong MAX_WRONG and so_far != word:
    print HANGMAN[wrong]
    print "YOu have used:\n",used
    print "\nso far the word is:\n",so_far

guess=raw_input("\n\nEnter your guess:")
guess=guess.upper()

while guess in used:
    print "You have already guessed the letter".guess
    guess=raw_input("enter your guess")
    guess=guess.upper()
    used.append(guess)
if guess in word:
    new=""
    for i in range(len(word)):
        if guess==word[i]:
            new+=guess
        else: 
            new+=so_far[i]
    so_far=new

else:
    print "INCORRECT"
    wrong+=1
if wrong==MAX_WRONG:
    print HANGMAN[wrong]
else:
    print "YAAAAY"

    print "the word was",word

All help is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:13:46+00:00Added an answer on May 27, 2026 at 10:13 am

    wrong MAX_WRONG does not make sense. You’ll need an operator between those two identifiers. You’re probably looking for <.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this program I'm writing, it would need frequent database communication, and at the
I am writing a small C++ program for fun and for extending my C++
first question here! I'm writing a grep type program for Windows, just for fun
I'm writing a Python program for fun but got stuck trying to import a
I've been writing a little program for fun that transfers files over TCP in
I am writing a mad libs program for fun and to just program something.
For a program that I am writing for fun (one that finds the Greatest
Im writing a program that should read input via stdin, so I have the
I'm writing a program that sends an email out at a client's specific local
I am writing a program which has two panes (via CSplitter ), however I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.