# Examples stage.set_background("underwater") mysprite = codesters.Sprite("scubadiver2",0,-100) # Variables are orange - mysprite, stage # Strings are green - "underwater" "scubadiver2" # Constants are blue - 0, -100 # = sign means assignment mysprite.say("Hello!") stage.wait(2) name = mysprite.ask("What is your name?") name = name.capitalize() mysprite.say("That's a nice name, " + name) stage.wait(2) answer = mysprite.ask("Do you like the ocean?") answer = answer.lower() # I use the answer.lower() call so I don't have # to translate all the possible answers, e.g. # yes, Yes, YES and test for all of them # I could have written this # if answer == "y": # else if answer == "yes": # else if answer == "y" or answer == "yes": mysprite.say("Me too!") else: stage.set_background("winter") mysprite.say("That's ok, I like winter too!") stage.wait(2) mysprite.say("Maybe I should change clothes") stage.wait(2) stage.remove_sprite(mysprite) mysprite = codesters.Sprite("snowman",0,-100) # Notice that there's 4 spaces indented for each # line within the if/else stage.wait(2) flip = int(mysprite.ask("How many times should I flip?")) # this is a for loop. # Check out the P which is console output # note that if flip == 5, then counter goes # from 0 through 4. for counter in range(flip): print(counter) stage.wait(.5) mysprite.flip_right_left()