Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Trying to make a &[b]#34[/b];guess the number&[b]#34[/b]; game, why doesn't this work?

You need to put min_num and max_num in the global scope, i.e not inside a function.
(Oct 12, 2013 12:59 PM)monkeytherat Wrote:  It's better form to pass them as parameters and define them in the game function.

There are hundreds of ways to improve the code, he just told OP what needed to be done to get the error to go away.
(Oct 14, 2013 01:22 AM)BeerMonger Wrote:  question, what does that "chance()" refer to?
Is it defined somewhere? am I missing something?

LOL good catch, I didn't see that. That would also cause a problem, after his other one.
(Oct 14, 2013 01:47 AM)BeerMonger Wrote:  ...

Why would you do that? Then you can't compare the two numbers, because they will be strings.
(Oct 14, 2013 02:05 AM)BeerMonger Wrote:  Can you add ints to a string just like that? using "+"?
Cause when I tried it that didn't work.

No that doesn't work, you'd have to convert to one data type, or another.
(Oct 14, 2013 02:19 AM)BeerMonger Wrote:  So I was right..You do need to convert them to strings then back to ints..
Or how would you do it in another way that wont convert them to strings Skyla?

What part are you talking about? I'm confused.
Oh you're right in that part, I thought you were talking about the actual comparing.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by HardStoNJul 19, 2020 05:14 AM 7 290 Jul 19, 2020 05:14 AM
Last Post: DanketyDank
[C] by Sir BillyAug 26, 2019 06:33 PM 1 150 Aug 26, 2019 06:33 PM
Last Post: YouthInAsia
[Python] by kookurMar 4, 2019 04:18 PM 5 173 Mar 4, 2019 04:18 PM
Last Post: nicodxmus