'''
Author:
Class:
Description: A set of random game style functions that will get things
like a random roll of dice and random cards from a deck.
'''
import random
def randomChr(characters="abcdefghijklmnopqrstuvwxyz"):
'''
param characters - string of letters to pull a random character from,
defaults to "abcdefghijklmnopqrstuvwxyz"
returns a random character from the alphabet
'''
characters_length = len(characters)
index = random.randint(0,characters_length-1)
return characters[index]
'''
TODO: 5 Points
Write a function 'roll' that simulates the roll of a random die and
meets the following documentation:
Takes one default (optional) parameter that is the number of sides on the die
(defaults to 6).
params:
'sides' - number of sides on the die (defaults to 6, if not given)
returns - random int between 1 and 'sides' inclusively,
if sides < 1, returns None
Example usage:
roll(8) - returns a value x where 1 <= x <= 8
'''
'''
TODO: 5 Points
Write a function and associated documentation for a function called
'color' that will return the name of a random color. Your function must
return one of the strings 'green', 'red', or 'black' to the calling funciton.
Example usage:
color() - returns one of 'green', 'red', 'black'
'''
'''
TODO: 5 Points
Write a function that simulates a roulette spin called 'spinRoulette()''.
Roulette wheels are comprised of the numbers 0-36. Even numbers are colored
black and odd numbers are colored red. Zero is green. Each spin of the
roulette table the ball lands on one of these numbers. This function will
return a string that contains the results of the spin of the wheel,
including what number the ball landed on and the color of that number.
Return strings should be of the format:
[color] [number]
e.g.
red 27
black 9
green 0
params:
None
returns - Result of the spin in a string (str)
'''
'''
TODO: 10 Points
Write a function that simulates drawing a card from a full deck. This
function should be called 'randCard()'. This function will return a string
that contains the result of the draw and should be of the format:
[number|facecard] of [suit]
e.g.
1 of Spades
Jack of Clubs
Queen of Hearts
King of Diamonds
Ace of Spades
params:
None
returns - Result of the draw in a string (str)
'''