def createcard(recipient, years, closing, sender): Set up the background and create text…
- User
def create_card(recipient, years, closing, sender): # Set up the background and create text elements stage.set_background("sky_13e") yrs = codesters.Text(years + " years!!", 0, 200) yrs.set_size(2) text1 = codesters.Text("Dear " + recipient + ",", 0, 100) text2 = codesters.Text("Hope your special day is filled with joy!", 0, 50) text3 = codesters.Text(closing + ",", 0, 0) text4 = codesters.Text("Best wishes,", 0, -50)
code# Create a sprite (e.g., penguin) and get user input sprite = codesters.Sprite("penguin") sprite.set_size(0.5) sprite.set_speed(2) # Ask for user input recipient = sprite.ask("What is the name of the birthday person?") years = sprite.ask("How old will this person be?") closing = sprite.ask("How do you want to close your card? (love, from, sincerely, etc.)") sender = sprite.ask("What is your name?") # Hide the sprite after obtaining user input sprite.hide() # Display the greeting card stage.wait(1) # Wait for a moment before displaying the cardCall the function with user input
create_card("", "", "", "")
1) Create a function that takes parameters for a greeting card
- Must have a background with at least 2 sprites
- Must have at least three different text parameters
2) Ask for user input to get values for the function parameters
- Ask for receivers names
- Ask for giver's name
- Third is your choice
3) Pass the user input variable into the function in the call line
**** Extra credit, use parameters and ask input to dictate how many sprites show on the card. **** Ask for the type of card to receive (at least two different card choices and all previous requirements)
- Assistant