473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hangman(game) problem

i have a problem with the following
(some vaiation of a word quiz game)
(ignore first group of hashs)
Expand|Select|Wrap|Line Numbers
  1. import random
  2. WordTank=''
  3. GuessTank=''
  4. GuessList=12
  5. GuessWords=['tank','poop','poopster']
  6. GuessWord=random.choice(GuessWords)
  7.  
  8. def MajorInputPlace(GuessList,GuessTank,WordTank):
  9.     while 1:
  10.         print 'Please insert your guess below'
  11.         MainInput=raw_input('')
  12.         ###If letters in GuessWord are in WordTank:
  13.         ####print 'you won','The word was',GuessWord
  14.         ####raise SystemExit
  15.         if MainInput!='':
  16.             GuessList=int(GuessList)-int(1)
  17.             for word in MainInput:
  18.                     for i in word:
  19.                         if i in WordTank:
  20.                             if int(WordTank.count(i))< int(GuessWord.count(i)):
  21.                                 WordTank+=i+','
  22.                             else:
  23.                                 pass
  24.                     if word not in GuessWord:
  25.                         if word in GuessTank:
  26.                             pass
  27.                         else:
  28.                             GuessTank+=word+','
  29.             if GuessTank=='':
  30.                 pass
  31.             else:
  32.                 print 'The letters',GuessTank,'Are not in the word'
  33.             if WordTank=='':
  34.                 print WordTank
  35.             else:
  36.                 print 'The letters',WordTank, 'Are in the word'
  37.             while GuessList>0:
  38.                 break
  39.             while GuessList==0:
  40.                 print 'You Failed!'
  41.                 continue
  42.         else:
  43.             print 'NO INPUT'
  44.         print 'You have '+str(GuessList)+' Guesses left!'
  45. print 'You have '+str(GuessList)+' Guesses left!'
  46. MajorInputPlace(GuessList,GuessTank,WordTank)
  47. def Win():
  48.     print 'Congratulations, You have won the game, yeepy :D'
I am having a problem with this line -'if int(WordTank.count(i))< int(GuessWord.count(i)):'- i tried few variations, but non-of-them seems to work (
any suggestions?
Thank you in advance,
Netwatcher
Oct 4 '08 #1
1 1578
got that one figured =/
Expand|Select|Wrap|Line Numbers
  1.  if MainInput!='':
  2.             GuessList=int(GuessList)-int(1)
  3.             q=list(MainInput)
  4.             for i in q:
  5.                 if i in GuessWord:
  6.                     if WordTank.count(i)<GuessWord.count(i):
  7.                         WordTank+=i+','
  8.                     else:
  9.                         pass
now how do i check if all the words in a certine list are in a string?


Edit:
oh crap... seems like i don't need help anyways....
Expand|Select|Wrap|Line Numbers
  1.  MainInput=raw_input('')
  2.         pop=list(GuessWord)
  3.         for i in GuessWord:
  4.             pass
  5.         if WordTank.count(i)==GuessWord.count(i):
  6.             print 'VICTORY'
  7.             raise SystemExit
  8.         else:
  9.             pass
  10.  
Delet This post please
Oct 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: tigrfire | last post by:
So I'm trying to write a hangman game and the output is coming out a little strange. Here's my code thus far: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> ...
18
ilikepython
by: ilikepython | last post by:
Hi I'm new to Python(3 to 4 days) and I'm working on a hangman game and have been having some problems that really annoy me. Here is part of my script: c = input('Would you like to play hangman?...
16
by: python101 | last post by:
I've seen several versions of Hangman game written in many different computer languages like Pascal, C++, Java and even in my TI calculator ( I don't know what the code mean, but what kind of...
11
by: dav3 | last post by:
I am trying to code a little console program (no swing, no awt, just console). But I am having some trouble and I am not sure if its my logic, or my code, or possibly both?! Anyways heres what I...
2
by: tesa | last post by:
I am not able to figure out how to make this work. I am trying to create a hangman game. I am in a basic javascripting class. I am to only use very basic code as you can see. I am able to use any...
0
by: Madmartigan | last post by:
Hi I'm a newbie to C# and have been instructed to create a Hangman game in SharpDevelop. I don't want the answer to the full code, just some help along the way. I have included my code thus...
5
by: av3rage | last post by:
I have never done any programming in my life but I have decided to go into engineering and in doing so we have to take this intro to programming course and I am pretty clueless. I am starting to get...
8
by: tidiz | last post by:
Hi, I'm trying to make a hangman game that should look like this: Welcome to Hangman ______ Your guess: c Success! __cc__ Your guess: b
1
by: AlexSc | last post by:
Hi to All, I am doing on a hangman project, Where this is a very simple one, where player would guess the word and if it is correct the letter would be from "-" to the correct letter once all...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.