# Number Game code (its impossible to win )

Page 1 of 1

## 2 Replies - 363 Views - Last Post: 08 October 2012 - 11:42 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=294783&amp;s=1e7d38436a7a2f70f74a4f89ebc7f290&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 ReconWo1f

Reputation: 0
• Posts: 2
• Joined: 08-October 12

# Number Game code (its impossible to win )

Posted 08 October 2012 - 01:33 PM

```import random
import sys

print ("hi")

enter = "Please press Enter to continue!"

print ("Hello! welcome to the Ninja Master Gordon number Guessing game!")
print ("Please Guess the Black Ninja clan's number between 1 - 100!")
computernum = random.randint (1,1)
Guess1 = input("My First Guess Is: ")
if Guess1 == computernum:
print ("You have defeated the Black Ninja Clan! you are a WINNER!!!")
input (enter)
sys.exit(0)
else:
print ("YOU HAVE ONLY TWO GUESSES REMAINING!")
Guess2 = input ("My second Guess Is: ")
if Guess2 == computernum:
print ("You have defeated the Black Ninja Clan! you are a WINNER!!!")
input (enter)
sys.exit(0)
else:
print ("sorry , please try again")
print ("YOU HAVE ONLY ONE GUESS LEFT make it count...")
Guess3 = input ("My Final Guess Is: ")
if Guess3 == computernum:
print ("You have defeated the Black Ninja Clan! you are a WINNER!!!")
input (enter)
sys.exit(0)
else:
print ("YOU LOST AT THIS GAME!!! but dont let the Diamond Ninja Force down have another GO!")
computernum = str(computernum)
print ("The Black ninja clan's number was "+computernum)
input (enter)
sys.exit (0)
```

Its impossible to win and I cant find the error I thinks its because of the == section and Im using python 3.3

This post has been edited by Simown: 08 October 2012 - 01:41 PM
Reason for edit:: USE CODE TAGS!

Is This A Good Question/Topic? 0

## Replies To: Number Game code (its impossible to win )

### #2 NathanMullenax

Reputation: 81
• Posts: 176
• Joined: 23-September 12

## Re: Number Game code (its impossible to win )

Posted 08 October 2012 - 01:54 PM

It looks like the input is a string rather than an integer. If you wrap the input statements in int() like:

```GuessN = int(input("Guess N:"))

```

It works. Hope this helps. The odds of winning will still be really low, though: 3/100.

### #3 ReconWo1f

Reputation: 0
• Posts: 2
• Joined: 08-October 12

## Re: Number Game code (its impossible to win )

Posted 08 October 2012 - 11:42 PM

THANK YOU you are so much help and I'm so grateful for contribution !!!!!!!!!!!!!!!!!!!!!!