Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.
2
votes
Accepted
Determine the chance a streak of 6 HEADs or 6 TAILS appear in 100 flips, repeated 10000 times
streak = prev_streak
else:
streak = [] # new streak
streaks.append(streak)
streak.append(side)
For "nicer" code
numberOfStreaks = 0 #author wrote this line
The convention in Python … In Python, 0 is "fasley", which means flip() can be:
if random.randint(0, 1):
return "H" # when 1, "truthy"
else:
return "T" # when 0, "falsey"
When grouping, can do all the …
0
votes
3 dimensional python battleship game
StackExchange's Q&A format doesn't lend itself well to discussions, so I'll just point out a few random things, instead:
gameBoard should be GameBoard, by naming convention.
I can't really tell what/ …