[Tutor] random equation generator
srilyk at gmail.com
Thu Oct 23 12:46:20 CEST 2008
If you would like to develop the game, you should first try to develop the
game, and then ask when you get stuck.
If you can't figure out how to get a user to guess between operands '+',
'-', '*', '/' then my guess is you are very new to programming, and this
question shows you are very new to the tutor list. We're happy to help you
find a solution when you get stuck, but we won't write your program for you.
If you're stuck at the planning phase it seems that you may be trying to
tackle a subject that's a little too deep, and you'll find a lot of
difficulty in learning pyGTK.
Here are some assignments for you. Successfully completing these will not
only show that you're willing to learn and take advice, but they will also
help you in your quest to write your game.
tip: search google for the functions you should use, if you don't already
know them. Using the keyword "python" before the functionality will help
narrow your results.
1) Write a progam that will generate 10 random numbers in a /range/ of 0-3,
and print each one out.
After you do this, allow the user to /input/ the number of numbers (i.e. 5
instead of 10)
Please enter a number: 4
2) Write a program that allows the user to input a number 0-3, and
determines which operand to print.
Enter a number: 0
Enter a number: 1
Enter a number: 3
Enter a number: 2
Do these things and you'll be well on your way to writing your program!
(also, feel free to use http://pastebin.com to post your code to report on
If and only if you get stuck should you read this!
Seriously! Stop reading here! :)
Tip: Once you have searched google and the python docs for raw_input, while
loop, dict, list, if else, random and read all the documentation you can
find, if you cannot figure out the solution, only then should you ask
another question, and only about the topic on which you can't figure out on
On Thu, Oct 23, 2008 at 5:12 AM, i i <iaidas4 at gmail.com> wrote:
> hi, can u tell me any good tutorial site for pygtk, any that contains
> detail explanation of pygtk.
> i want to develop a game,that will randomly generate the operands,and the
> answer,a user have to chosse from the operators(+,-,*,/).
> which function should i use to randomly generate equation.
> Tutor maillist - Tutor at python.org
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor