On Tue, 22 Jan 2013 15:08:09 -0000, Darren Fitzpatrick <[email protected]> wrote:


hi can anyone point me to any good tutorials on how to use the random method in python

The standard library documentation is a great place to start if you haven't been there already: http://docs.python.org/2/library/random.html


i am trying to write a simple game in panda3D which involves randomly putting an object at the top of the screen and >moving it to a random position at the bottom of the screen

Since I don't know what way you are indexing your grid, I'll show how you can get a random float, and a random integer withing a range.

import random
rand_float = random.random() # random float between 0.00 and 1.00
rand_float_range = random.uniform(1,10) # random float between 1.00 and 10.00
rand_int_range = random.randint(1,10) # random integer between 1 and 10


i know how to solve the problem however i do not know how to code it so does anyone know of a good python website for >beginners which has code examples
This website is good: http://www.codecademy.com/tracks/python
Also try: http://www.udacity.com/overview/Course/cs262/CourseRev/apr2012


thanks i would really appreciate the help
Darren
--



--
Diarmuid Bourke

--


Reply via email to