### Thread: Noob needs help with game issues!

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Oct 2013
Posts
5
Rep Power
0

#### Noob needs help with game issues!

Hey everyone! I'm new to this forum and new to programming. I picked up Python yesterday and working at it determinedly. I have made a few calculators and I decided to make a game using what I knew. For some reason the game works about half the time, and about the other half of the time it ends either during the 2nd or 3rd turn. (Could be higher, but all I've gotten playing it so far) The game is a guess a number between... game. Here is what I have:
Code:
```print("Guess the number game!")

playerName = input()

print("Try to guess my number.  It's between 1 and 100!")

import random

Number = random.randint(1, 100)

GuessCounter = 0
Guess1 = int(input())
while (Guess1) > (Number):
print("It's lower!")
Guess1 = int(input ())
(int(GuessCounter + 1))
while Guess1 < Number:
print("It's higher!")
Guess1 = int(input ())
(int(GuessCounter + 1))
if Guess1 == Number:
print('Wahooooo!  You got it!')

print('The number was', Number)

print(GuessCounter)

print('Thanks for playing,', playerName, '!')```
Please help! Also, being a noob, I'm not up to par with coding standards. If you notice anything I could do that could make my work better or more consistent, please let me know!
*Edit: Python 3.3.2, Windows.
2. We don't know the rules you intend your game to enforce. Thus we do not know the program problem. Still, you probably meant
Code:
```# python 3

import math, random

print("Guess the number game!")
playerName = input()
print("Try to guess my number.  It's between 1 and 100!")

Number = random.randint(1, 100)
prompt = 'What is your first guess?'
GuessCounter = 0

while GuessCounter < math.log(100, 2):

while True: # trap bad input
try:
Guess1 = int(input(prompt+' '))
except:
else:
break

GuessCounter += 1
if Number < Guess1:
prompt = "It's lower!"
elif Guess1 < Number:
prompt = "It's higher!"
else:
print('Wahooooo!  You got it!')
break

print('The number was', Number)
print(GuessCounter)
print('Thanks for playing,', playerName, '!')```