Re: [Tutor] guess my number game (reversed)

2018-10-06 Thread Peter Otten
chiara pascucci wrote: > Hi, > > sorry for "resurrecting" this thread. I have tried doing as suggested but > with no luck. > I now managed to make the programme work "partially". It works as desired > for "too high" and "right" answer input, but when the users input "too > low" the programme clos

Re: [Tutor] guess my number game (reversed)

2018-10-06 Thread chiara pascucci
Hi, sorry for "resurrecting" this thread. I have tried doing as suggested but with no luck. I now managed to make the programme work "partially". It works as desired for "too high" and "right" answer input, but when the users input "too low" the programme closes. here is what the code looks like r

Re: [Tutor] guess my number game (reversed)

2018-06-01 Thread Farooq Karimi Zadeh
Add a new variable named "number of guesses", increase it each time and break the loop when it reaches, for example 10. This means user can have 10 guesses max. If they couldn't guess the number, they are losers! You also could do the opposite: have number of guesses=10 in the beginning and decreas

Re: [Tutor] guess my number game (reversed)

2018-06-01 Thread Alan Gauld via Tutor
On 01/06/18 14:00, chiara pascucci wrote: > the user's input. The programme works fine if the it guesses the number > right on its first try, but when the users inputs "too low" or "too high" > an infinite loop is returned. I thinkI have done something wrong in my > while loop and that my sentry v

[Tutor] guess my number game (reversed)

2018-06-01 Thread chiara pascucci
Hello. I am very new to learning Python, and I would need some help with a little game I am trying to write. I am trying to write a game where the user is asked to think of a number from 1 to a 100, and the computer tries to guess it. Now, after every guess I would want the programme to ask whethe

Re: [Tutor] guess my number game

2018-05-09 Thread Kerri Murphy
Perhaps the indentation was changed when I copy and pasted it, but also we've only been using codeskulptor to run our answers. That code did work on ours, so that is weird. But yes there are a lot of errors. We just type it into code skulptor and press play. A box pops up for any user input.

Re: [Tutor] guess my number game

2018-05-09 Thread Kerri Murphy
Hi there, Yes, the first code does a good job by asking them to go higher or lower after each guess, in the pop up window. The 2nd code works, but only outputs all the higher and lower outputs after the 10 guesses. Everyone in the class has the same result basically. When I searched on various

Re: [Tutor] guess my number game

2018-05-09 Thread Alan Gauld via Tutor
On 9 May 2018 2:30 am, Kerri Murphy wrote: Hi there, Yes, the first code does a good job by asking them to go higher or lower after each guess, in the pop up window. My point is that the code you posted can't even run, let alone do a good job. The indentation is all messe

Re: [Tutor] guess my number game

2018-05-08 Thread Alan Gauld via Tutor
The first block of code is full of errors and couldn't work so I have no idea what you were really doing! The second block should kind of work. From your description I'd guess you have an indentation error such that most of the code that should be inside the loop is being bypassed. Are you sur

Re: [Tutor] guess my number game

2018-05-08 Thread Mats Wichmann
On 05/08/2018 06:04 AM, Jan Erik Moström wrote: > >> Here is the code with the while loop >> import random >> n = (random.randint(0,100)) >> g = int(input('Guess my number, 0 to 100, you have 10 chances')) you should get your students into good programming habits right away. Here you are taking d

Re: [Tutor] guess my number game

2018-05-08 Thread Jan Erik Moström
Here is the code with the while loop import random n = (random.randint(0,100)) g = int(input('Guess my number, 0 to 100, you have 10 chances')) c = 0 while (c < 10): g = int(input('Guess my number, 0 to 100, you have 10 chances')) c = c + 1 if (g >= n): print('Lower!') el

[Tutor] guess my number game

2018-05-08 Thread Kerri Murphy
My students are creating a guess my number game. They are trying to take this type of code (the flow of it), and turn it into a code using a while loop. Here is the first code n = int(input('Guess my number: '))if (n <= 172 and n >= 174): print('Correct')elif (n >= 174): a = int(input('Go

Re: [Tutor] Guess the number

2015-05-11 Thread Kewal Patel
i don't know if this is efficient but i think it works just fine import random # input a number from user input_number = input("Enter a number") #function defination def guess_number(start,stop): global input_number try: g_number = random.randrange(start,stop) if g

Re: [Tutor] Guess the number

2015-05-07 Thread Alan Gauld
On 07/05/15 05:09, Ikaia Leleiwi wrote: number might be. If the guess is lower then the inputted number then the user inputs the word 'higher' to indicate the computer needs to guess a higher number. If the guess is higher than the inputted number then the user inputs the word 'lower' to indic

[Tutor] Guess the number

2015-05-07 Thread Ikaia Leleiwi
I am having trouble writing a program that guesses a number inputted by the user. A number between 1-100 is inputted into the program and the computer produces a random integer that is the "guess" as to what the inputted number might be. If the guess is lower then the inputted number then the use

Re: [Tutor] "Guess My Number" Python 3.4.0 Program partially fixed but now has Logic Errors

2014-04-29 Thread Peter Otten
Stephen Mik wrote: > Stephen Mik-novice programmer-getting desperate Don't despair just yet! As a programmer you will be constantly producing and fixing errors. That is business as usual. What will change is that you will produce trickier bugs as your knowledge level increases... > Dear Sir(s)

[Tutor] "Guess My Number" Python 3.4.0 Program partially fixed but now has Logic Errors-by Stephen Mik-novice programmer-getting desperate

2014-04-29 Thread Stephen Mik
Dear Sir(s):     I am new to Python programming,and I have a "Guess My Number" program which partially works. The main while control works,the guessing of an integer between 1 and 60 seems to give the "too high" or "too low" elif branches effectively. However,when the correct number is guessed t

Re: [Tutor] Guess my number game

2013-12-07 Thread Steven D'Aprano
On Fri, Dec 06, 2013 at 11:34:13PM +, Lelani Slabber wrote: > I have to add code so the user has a limited number of tries - in this > case I have set it to less than 5 in the while loop and I want the > program to stop if the tries are equal to 5.  I get an invalid syntax > error.  Please

Re: [Tutor] Guess my number game

2013-12-07 Thread Joel Goldstick
On Sat, Dec 7, 2013 at 9:16 AM, Mark Lawrence wrote: > On 06/12/2013 23:34, Lelani Slabber wrote: > >> Hi, >> I am learning Python witht Python for beginners book by Michael Lawson >> and have trouble with one task in chapter 3 - challenge 3. >> I have to add code so the user has a limited number

Re: [Tutor] Guess my number game

2013-12-07 Thread Mark Lawrence
On 06/12/2013 23:34, Lelani Slabber wrote: Hi, I am learning Python witht Python for beginners book by Michael Lawson and have trouble with one task in chapter 3 - challenge 3. I have to add code so the user has a limited number of tries - in this case I have set it to less than 5 in the while lo

[Tutor] Guess my number game

2013-12-07 Thread Lelani Slabber
Hi,   I am learning Python witht Python for beginners book by Michael Lawson and have trouble with one task in chapter 3 - challenge 3.   I have to add code so the user has a limited number of tries - in this case I have set it to less than 5 in the while loop and I want the program to stop if t

Re: [Tutor] Guess my number game

2011-11-20 Thread Alan Gauld
On 20/11/11 15:29, myles broomes wrote: > ...I was told to have a go at writing up the actual code. Well done, thats a good start. #guess my number games #the user thinks of a number between 1 and 100, #the computer then has to try and guess that number #welcome the player to the game and expl

[Tutor] Guess my number game

2011-11-20 Thread myles broomes
I asked for advice yesterday with some pseudocode for a 'guess my number' game I wrote up, and I was told to have a go at writing up the actual code. I've had a go but im struggling... #guess my number games #the user thinks of a number between 1 and 100, #the computer then has to try and guess

Re: [Tutor] Guess my number game

2011-11-19 Thread Alan Gauld
On 19/11/11 12:53, myles broomes wrote: ...Here is the pseudocode I have written up: Once the user has thought of their number, take a guess While the number has not been guessed correctly Increase the number of 'tries' by 1 Ask the user if the guess was too high or too low

Re: [Tutor] Guess my number game

2011-11-19 Thread bob gailer
On 11/19/2011 8:14 AM, delegb...@dudupay.com wrote: Hi Myles, Pseudocodes are what anyone would write but they only lay an idea of what you intend to achieve. To get quick help, you need to write the actual code and tell us where the trouble spot is. This way we can help you get along. [sni

Re: [Tutor] Guess my number game

2011-11-19 Thread delegbede
MTN -Original Message- From: myles broomes Sender: tutor-bounces+delegbede=dudupay@python.org Date: Sat, 19 Nov 2011 12:53:40 To: Subject: [Tutor] Guess my number game I am currently learning Python from the 'Python Programming for the Absolute Beginner' book. At the e

[Tutor] Guess my number game

2011-11-19 Thread myles broomes
I am currently learning Python from the 'Python Programming for the Absolute Beginner' book. At the end of each chapter, you are given challenges and one of the challenges is to make a 'Guess My Number' game where the player thinks of a number between 1 and 100 and the computer has to guess the

Re: [Tutor] guess age programme (please help)

2011-10-01 Thread Walter Prins
Hi, On 1 October 2011 05:13, Steven D'Aprano wrote: > Hi all, can anyone help me with the attached programme. >> > > ADRIAN KELLY wrote: > I'd love to, but I can't open it :( > > If the truth be known, I could open it if I spent the time and effort. But > that actually is significant time and ef

Re: [Tutor] guess age programme (please help)

2011-10-01 Thread Alan Gauld
On 01/10/11 05:13, Steven D'Aprano wrote: (2) For larger amounts, say, more than 50 lines, attach it as a file. Or put it on one of the several public web pastebins. That will give us all syntax colouring and no ambiguity about indentation levels etc that often seems to occur via email. htt

Re: [Tutor] guess age programme (please help)

2011-09-30 Thread Steven D'Aprano
Hi Adrian, ADRIAN KELLY wrote: Hi all, can anyone help me with the attached programme. I'd love to, but I can't open it :( If the truth be known, I could open it if I spent the time and effort. But that actually is significant time and effort: in my email, your attachment looks like this:

Re: [Tutor] guess age programme (still stuck!!!!!)

2011-09-30 Thread Alan Gauld
On 30/09/11 21:21, Dave Angel wrote: print "\n\nGood guess!!" input ("\n\nPress the enter key to exit.") input() returns a character string. Given the OP's print style I assume he is running Python v2 so input() will evaluate a number as an int. But given that using input() is usually fro

Re: [Tutor] guess age programme (still stuck!!!!!)

2011-09-30 Thread Dave Angel
(Please don't top-post. Place your remarks after whatever quoting you do from the previous message. And trim the parts that are no longer relevant) On 09/30/2011 03:18 PM, ADRIAN KELLY wrote: please guys still stuck on this problem and i have been at it for hours so please if anyone can hel

Re: [Tutor] guess age programme (still stuck!!!!!)

2011-09-30 Thread bodsda
: Subject: Re: [Tutor] guess age programme (still stuck!) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor

Re: [Tutor] guess age programme (still stuck!!!!!)

2011-09-30 Thread ADRIAN KELLY
:print "Correct...well done!!"else:breakprint "Out of attempts" print "\n\nGood guess!!" input ("\n\nPress the enter key to exit.") Date: Fri, 30 Sep 2011 14:31:52 +0200 From: cwi...@compuscan.co.za T

Re: [Tutor] guess age programme (please help)

2011-09-30 Thread Christian Witts
On 2011/09/30 02:04 PM, ADRIAN KELLY wrote: Hi all, can anyone help me with the attached programme. it is fairly basic (like me) i want it to ask the user to guess the age and countdown when making incorrect guesses. it doesn't seem to count the first attempt (run it and see please). i also

Re: [Tutor] guess age programme (please help)

2011-09-30 Thread bodsda
es+bodsda=googlemail@python.org Date: Fri, 30 Sep 2011 12:04:58 To: Subject: [Tutor] guess age programme (please help) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/ma

[Tutor] guess age programme (please help)

2011-09-30 Thread ADRIAN KELLY
Hi all, can anyone help me with the attached programme. it is fairly basic (like me) i want it to ask the user to guess the age and countdown when making incorrect guesses. it doesn't seem to count the first attempt (run it and see please). i also want to know how to go about setting a cond

Re: [Tutor] guess-my-number programme

2011-09-24 Thread Kĩnũthia Mũchane
On 09/23/2011 11:28 PM, Wayne Werner wrote: On Fri, Sep 23, 2011 at 2:25 PM, ADRIAN KELLY > wrote: can anyone explain the *_tries_* part of this programme to me i know its meant to count the number of guesses made by the user by adding 1 but i ju

Re: [Tutor] guess-my-number programme

2011-09-23 Thread Wayne Werner
On Fri, Sep 23, 2011 at 2:25 PM, ADRIAN KELLY wrote: > > can anyone explain the *tries* part of this programme to me i know its meant > to count the number of guesses made by the user by adding 1 but i just cant > figure out how it does this..can someone explain?? i.e. tries = 1, > tries

Re: [Tutor] guess-my-number programme

2011-09-23 Thread Emile van Sebille
On 9/23/2011 12:25 PM ADRIAN KELLY said... can anyone explain the *tries * part of this programme to me i know its meant to count the number of guesses made by the user by adding 1 but i just cant figure out how it does this..can someone explain?? i.e. tries = 1, tries +1 etc cant g

[Tutor] guess-my-number programme

2011-09-23 Thread ADRIAN KELLY
import random print("\tWelcome to 'Guess My Number'!") print("I'm thinking of a number between 1 and 100.") print("Try to guess it in as few attempts as possible.\n") # set the initial values the_number = random.randint(1, 100) guess = int(input("Take a guess: ")) tries = 1 # guessing loop while

Re: [Tutor] Guess my number? Guess what's wrong!

2010-04-19 Thread Matthew Carpenter-Arevalo
Thanks! On Sat, Apr 17, 2010 at 1:32 PM, Jim Byrnes wrote: > Matthew Carpenter-Arevalo wrote: > >> Hi Everyone, >> >> I'm a beginner python programmer, and I've been working on >> the perennial 'guess my number' example. >> >> When I run this in my module, I get an infinite loop of 'higher' or

Re: [Tutor] Guess my number? Guess what's wrong!

2010-04-17 Thread Jim Byrnes
Matthew Carpenter-Arevalo wrote: Hi Everyone, I'm a beginner python programmer, and I've been working on the perennial 'guess my number' example. When I run this in my module, I get an infinite loop of 'higher' or 'lower.' Can anyone see where I'm going wrong herE? Thanks, MCA # Guess my nu

Re: [Tutor] Guess my number? Guess what's wrong!

2010-04-17 Thread Marc Tompkins
On Sat, Apr 17, 2010 at 1:04 PM, Matthew Carpenter-Arevalo < matthew.carpenter.arev...@googlemail.com> wrote: > Hi Everyone, > > I'm a beginner python programmer, and I've been working on > the perennial 'guess my number' example. > > When I run this in my module, I get an infinite loop of 'higher

[Tutor] Guess my number? Guess what's wrong!

2010-04-17 Thread Matthew Carpenter-Arevalo
Hi Everyone, I'm a beginner python programmer, and I've been working on the perennial 'guess my number' example. When I run this in my module, I get an infinite loop of 'higher' or 'lower.' Can anyone see where I'm going wrong herE? Thanks, MCA # Guess my number # the computer picks a random

Re: [Tutor] guess my number game

2007-03-27 Thread Dick Moores
At 03:16 AM 3/27/2007, Alexander Kapshuk wrote: I’m working on a program that has the user think of a number between 1 and 100 and then tries to guess that number.   I’m having trouble telling the computer to keep on looking for the correct number, each time narrowing down the search range.   Ple

Re: [Tutor] guess my number game

2007-03-27 Thread Alexander Kapshuk
I'm working on a program that has the user think of a number between 1 and 100 and then tries to guess that number. I'm having trouble telling the computer to keep on looking for the correct number, each time narrowing down the search range. Please see the code below. import random

Re: [Tutor] guess]

2006-10-04 Thread Alan Gauld
> def number(number): > ran=input("range >") > ran=ran+1 > from random import randrange > guessed=[] > guess=randrange(ran) > print guess > guessed.append(guess) > guesses=1 > guessed=[] < Why do you reset guessed to an empty list > here? also couldn'

Re: [Tutor] Guess Your Number Game

2006-01-17 Thread Edgar Antonio Rodríguez Velazco
Check this:   ### import random print "Welcome to 'Guess Your Number'!"print "\nThink of a number between 1 and 100."print "And I will try and guess it!\n"print "Valid inputs are: higher, lower and correct." raw_input("\n\nPress enter once y

Re: [Tutor] Guess Your Number Game

2006-01-17 Thread Rinzwind
On 1/17/06, Jon Moore <[EMAIL PROTECTED]> wrote: > Hi > > I hope someone can help me! > > I am currently learning Python using a book by Michael Dawson. In one of the > exercises I have to right a program that will guess a number chosen by the > user. > > It is partly working, however it does not s

[Tutor] Guess Your Number Game

2006-01-17 Thread Jon Moore
HiI hope someone can help me!I am currently learning Python using a book by Michael Dawson. In one of the exercises I have to right a program that will guess a number chosen by the user.It is partly working, however it does not seem to keep state of numbers that should have already been ruled out a

Re: [Tutor] Guess my number game

2005-12-15 Thread Brian van den Broek
Pujo Aji said unto the world upon 2005-12-15 14:52: > Hi, > your guess still use random.randrange that's make computer doesn't care > about whether guess is low or higher than your number. > > This code should be like this: > Hope this help > > pujo > > On 12/15/05, William Mhlanga <[EMAIL PR

Re: [Tutor] Guess my number game

2005-12-15 Thread Murtog
Try this code: #The Guess My Number Game # #The computer picks a random number between 1 and 50 #The player tries to guess it and the computer lets #the player know if the guess is too high, too low #or right on the money #If the player fails to guess the number after 5 tries #the game ends and th

Re: [Tutor] Guess my number game

2005-12-15 Thread Simon Gerber
Hi William, Just a word of warning, you should get used to using 'raw_input()' rather than 'input()' in your progams. Why? Because input() attempts to run whatever you type in as a Python program. If you want to know why that's a problem, try running your progam. When it asks you to "Enter the nu

Re: [Tutor] Guess my number game

2005-12-15 Thread Pujo Aji
Hi, your guess still use random.randrange that's make computer doesn't care about whether guess is low or higher than your number.This code should be like this:    print "\t\t\tWelcome to \"Guess My Number\"!"     print "\nThink of a number between 1 and 50."    print "I will try to guess it in as

[Tutor] Guess my number game

2005-12-15 Thread William Mhlanga
I have been trying to write a guess my number game (using Michael Dawsons book), where the computer guesses the number that I thought of. Here is my code so far,#The Guess My Number Game ##The computer picks a random number between 1 and 50#The player tries to guess it and the computer lets#the pla

Re: [Tutor] Guess my number?

2005-08-07 Thread Joseph Quigley
Hi. > I want the program to say "You're stupid!" When a player fails to guess in > 10 tries. > But, it's not working.. Very simple fix for bug: > elif (guess < number): > print "Higher...\n" > elif (tires > 10): > print "You're stupid!" > else: > print "Error!

Re: [Tutor] Guess my number?

2005-08-07 Thread Rob Andrews
Let's take a look I pasted your code into a new window and gave it a go. You used tabs for indentation (or they got in there somewhere in the email/copy/paste process), which confused my tiny mind, so I replaced 'em with spaces. I noticed a few things. Here's my code:

[Tutor] Guess my number?

2005-08-07 Thread . ,
I want the program to say "You're stupid!" When a player fails to guess in 10 tries. But, it's not working.. import random number = random.randrange(100) + 1 guess = int(raw_input("Take a guess: ")) tries = 1 while (guess != number): if (guess > number): print "Lower...\n" elif

Re: [Tutor] guess the number game help

2005-04-30 Thread Diana Hawksworth
uot;Max Noel" <[EMAIL PROTECTED]> Cc: "Diana Hawksworth" <[EMAIL PROTECTED]>; Sent: Sunday, May 01, 2005 6:58 AM Subject: Re: [Tutor] guess the number game help > > > And if they do understand it and know how to modify it then even > if > > > t

Re: [Tutor] guess the number game help

2005-04-30 Thread Alan Gauld
> > And if they do understand it and know how to modify it then even if > > they did copy it they did the assignment and understood the code. > > Software reuse is not necessarily an evil to be stifled... > > > Have a look at the link I posted, Alan. Honestly, at that point > it's not "softwar

Re: [Tutor] guess the number game help

2005-04-30 Thread Max Noel
On Apr 30, 2005, at 19:50, Alan Gauld wrote: If my student has plagiarised - I need to know. Could you ask him(?) to explain some of the more "interesting" features? Maybe how he came up with the variable names? It is possible that he/she has come up with it themselves since its not really a great

Re: [Tutor] guess the number game help

2005-04-30 Thread Alan Gauld
> If my student has plagiarised - I need to know. Could you ask him(?) to explain some of the more "interesting" features? Maybe how he came up with the variable names? It is possible that he/she has come up with it themselves since its not really a great version - a very strange mix of OOP and pr

Re: [Tutor] guess the number game help

2005-04-30 Thread Max Noel
On Apr 30, 2005, at 09:49, Diana Hawksworth wrote: Hello list!   I have started teaching Python to a group of High School students. I set them the "Guess the Number" game as a GUI as an assignment. One of the students has passed in some script that is foreign to any tutorial work we have done. 

[Tutor] guess the number game help

2005-04-30 Thread Diana Hawksworth
Hello list!   I have started teaching Python to a group of High School students. I set them the "Guess the Number" game as a GUI as an assignment. One of the students has passed in some script that is foreign to any tutorial work we have done.  Some of it is below. Does anyone recognise it