Question: Magic Carpet Ride Function Name: aWholeNewWorld ( ) Parameters: numOfGuards ( int ) , isAsleep ( bool ) Returns: response ( str ) Description: Aladdin

Magic Carpet Ride
Function Name: aWholeNewWorld()
Parameters: numOfGuards ( int ), isAsleep ( bool )
Returns: response ( str )
Description: Aladdin stopped by to take Princess Jasmine on a magic carpet ride. However, she
has to sneak out to go.
Write a function called aWholeNewWorld() that takes in two parameters: the number of guards
( int ), and whether or not the Sultan is asleep ( bool ) to determine if she can go.
If there are no guards on duty and the Sultan is asleep, then Jasmine can go and you should
print the string "Let's go!".
If the Sultan is awake and there are no guards on duty, Jasmine can go and you should print
the string "I'll need to be back by midnight." .
If there are three guards or less on duty and the Sultan is asleep, Jasmine can go and you
should print the string "I can sneak around the guards." .
Finally, return the string "A dazzling place I never knew!" if Jasmine was able to go on the magic
carpet ride. Otherwise, return the string "Where's a genie when you need them?"
>>> aWholeNewWorld(0, False)
I'll need to be back by midnight.
"A dazzling place I never knew!"
>>> aWholeNewWorld(3, False)
"Where's a genie when you need them?"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!