i am trying to get random numbers on the percents at the end on the results heres what i got it works perfectly but the end result is always the same
import random
SERIES = 1000
game = 1
series = 1
while series < SERIES:
teamA = random.randint (1,8)
teamB = random.randint (1,8)
teams = teamA + teamB
if teams == 8:
game = game + 1
series = series + 1
print "In 1000 simulated series Team B won 248 % (SERIES,game)"
print "so I estimate there is a",(game / 20),"% chance they will win"
"the series.`"
In 1000 simulated series Team B won 248 % (SERIES,game)
so I estimate there is a 5 % chance they will win
is what i get everytime
i want to know how to get it to be a random number every time or else match the teachers result becase she got
In 1000 simulated series Team B won 248 series,
so I estimate there is a 24.8% chance they will win the series.
and if any one can please help me i dont know where to start off on here if u start it and leave out a bunch off stuff i can fill the rest in
Write a program that reads in the size of a square and a character and then prints out a hollow square of that size out of the specified character and blanks. Your program should work for squares of all sizes from 1 to 20 inclusive. Here is a sample run of the program,
random numbers
Page 1 of 12 Replies  1223 Views  Last Post: 16 October 2009  02:15 PM
Replies To: random numbers
#2
Re: random numbers
Posted 12 October 2009  07:57 PM
chrishaizimsque, on 12 Oct, 2009  03:46 AM, said:
i am trying to get random numbers on the percents at the end on the results heres what i got it works perfectly but the end result is always the same
import random
SERIES = 1000
game = 1
series = 1
while series < SERIES:
teamA = random.randint (1,8)
teamB = random.randint (1,8)
teams = teamA + teamB
if teams == 8:
game = game + 1
series = series + 1
print "In 1000 simulated series Team B won 248 % (SERIES,game)"
print "so I estimate there is a",(game / 20),"% chance they will win"
"the series.`"
In 1000 simulated series Team B won 248 % (SERIES,game)
so I estimate there is a 5 % chance they will win
is what i get everytime
i want to know how to get it to be a random number every time or else match the teachers result becase she got
In 1000 simulated series Team B won 248 series,
so I estimate there is a 24.8% chance they will win the series.
and if any one can please help me i dont know where to start off on here if u start it and leave out a bunch off stuff i can fill the rest in
Write a program that reads in the size of a square and a character and then prints out a hollow square of that size out of the specified character and blanks. Your program should work for squares of all sizes from 1 to 20 inclusive. Here is a sample run of the program,
import random
SERIES = 1000
game = 1
series = 1
while series < SERIES:
teamA = random.randint (1,8)
teamB = random.randint (1,8)
teams = teamA + teamB
if teams == 8:
game = game + 1
series = series + 1
print "In 1000 simulated series Team B won 248 % (SERIES,game)"
print "so I estimate there is a",(game / 20),"% chance they will win"
"the series.`"
In 1000 simulated series Team B won 248 % (SERIES,game)
so I estimate there is a 5 % chance they will win
is what i get everytime
i want to know how to get it to be a random number every time or else match the teachers result becase she got
In 1000 simulated series Team B won 248 series,
so I estimate there is a 24.8% chance they will win the series.
and if any one can please help me i dont know where to start off on here if u start it and leave out a bunch off stuff i can fill the rest in
Write a program that reads in the size of a square and a character and then prints out a hollow square of that size out of the specified character and blanks. Your program should work for squares of all sizes from 1 to 20 inclusive. Here is a sample run of the program,
would you not use 248/1000*100 to come up with the 24.8
#3
Re: random numbers
Posted 16 October 2009  02:15 PM
Please post in [ code ] [/ code ] tags !
Python is esp important since whitespace matters.... your code is unreadable....
Python is esp important since whitespace matters.... your code is unreadable....
Page 1 of 1
