Re: [Tutor] how to generate random numbers in Python

2013-10-05 Thread Bhanu Pratap Singh
/* Generating random number */ from random import randint print(randint(0,5)) >>> # anyone from 0 to 5 For generating only 0 or 1 print(randint(0,1)) >>> 0 or 1 Best, Bhanu Pratap www.bhanubais.com -Original Message- From: Tutor [mailto:tutor-bounces+bha

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-06-16 Thread Bhanu Pratap Singh
Hi Rafeal, You have called random function two times. It must be called single time and check if it produced 1 or 2. See my code. /* code ---*/ import random print(""" This program flips a coin 10 times. It then counts the number of heads and tails.

Re: [Tutor] changing char list to int list isn't working

2013-05-15 Thread Bhanu Pratap Singh
Hi Jim, When you replace num = int(num); it's not changing a list. Due to It only pick a value from a list. You have to pointing to list so, You have to use list[position] using while loop like below listOfNumChars = list(str(intNum)) i = 0 while i < len(listOfNumChars): listOfNumChars[i]