Statement of Completion#9ad3e8ce
Python Basics
medium
Capstone Project : Disneyland Adventure!
Resolution
Activities
Project.ipynb
1.Magical Registration Portal!¶
In [3]:
print("Hey! there, kindly please register yourself!")
# Define the variables
name = input('What is your name?')
age = int(input('How old are you?'))
fav_char = input('Who is your favorite character?')
# print the custom message
message = f"Welcome to Disneyland {name}!!, Your favorite character {fav_char}, awaits you. Have a magical day!"
print(message)
Hey! there, kindly please register yourself!
Welcome to Disneyland Alice!!, Your favorite character Minnie Mouse, awaits you. Have a magical day!
2. The Thrilling Roller Coaster Ride¶
In [8]:
height = int(input("Enter your height: "))
weight = int(input("Enter your weight: "))
can_ride = ''
# write the ride-check logic here
if height >= 150 and weight > 20:
can_ride = True
else:
can_ride = False
print(can_ride)
False
3. Shopping Spree!!¶
In [12]:
# Choice 1 :
mickey_ears = 30
# Choice 2 :
tiara = 25
def souvenir_shop(budget, choice):
try:
if choice == 1:
item = "Mickey Ears"
cost = mickey_ears
elif choice == 2:
item = "Tiara"
cost = tiara
else:
raise ValueError
if cost < budget:
return f"{item} purchased"
else:
return f"Insufficient funds for {item}"
except ValueError:
return "Invalid choice"
print(souvenir_shop(80, 1))
print(souvenir_shop(20, 1))
print(souvenir_shop(30, 2))
print(souvenir_shop(20, 2))
print(souvenir_shop(40, 5))
Mickey Ears purchased Insufficient funds for Mickey Ears Tiara purchased Insufficient funds for Tiara Invalid choice
4. Wish Maker!¶
In [23]:
def wish_maker(wish):
print("Welcome to the Disneyland Wish Maker!")
reversed_wish = ""
# write the logic here
for char in wish:
reversed_wish += (char)
reversed_wish = reversed_wish[::-1]
return f"Your magical wish transformation is complete! Your transformed wish is : {reversed_wish}"
wish_maker('Excel in Academics') # Enter your wish
Welcome to the Disneyland Wish Maker!
Out[23]:
'Your magical wish transformation is complete! Your transformed wish is : scimedacA ni lecxE'
5. Castle Light Show¶
In [28]:
def castle_light_show(rows):
result = ""
for i in range(1, rows + 1):
result += f"Row {i}: " + "💡" * i + "\n"
result += "\n🏰 The castle light show has ended! Hope you enjoyed it!"
return result
output = castle_light_show(5)
print(output)
Row 1: 💡 Row 2: 💡💡 Row 3: 💡💡💡 Row 4: 💡💡💡💡 Row 5: 💡💡💡💡💡 🏰 The castle light show has ended! Hope you enjoyed it!
6. Mickey's Clock Tower!¶
In [33]:
def clock_tower_puzzle(hour, turns):
print("🕰️ Welcome to Mickey's Clock Tower! 🕰️")
print("Help Mickey fix the magical clock!\n")
# Calculate the new hour
new_hour = hour + turns % 24
return f"The clock started at {hour}:00 .... After {turns} magical turns... The new time is {new_hour}:00! ⏰"
clock_tower_puzzle(12, 2)
🕰️ Welcome to Mickey's Clock Tower! 🕰️ Help Mickey fix the magical clock!
Out[33]:
'The clock started at 12:00 .... After 2 magical turns... The new time is 14:00! ⏰'
7. The Magic Aladdin Carpet¶
In [35]:
def magic_carpet_ride(size, pattern):
result = ""
for i in range(size):
for j in range(size):
if (i + j) % 2 == 0:
result += pattern + " "
else:
result += "❤️ "
result += "\n"
return result
output = magic_carpet_ride(5, '☘️')
print(output)
☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️ ❤️ ☘️
8. Mickey's Magical Number Transform¶
In [37]:
def mickey_math(magic_number):
print("🎪 Welcome to Mickey's Mathematical Adventure! 🎪")
operations = 0
original = magic_number
while magic_number != 1:
if magic_number % 2 == 0:
magic_number = magic_number // 2
else:
magic_number = (3 * magic_number) + 1
operations += 1
print(f"Magic transformation #{operations}: {magic_number}")
if operations >= 20:
print("Oh my! That's quite a magical journey!")
break
return (f"Your number {original} needed {operations} magical transformations!")
9. Firework Show¶
In [38]:
def firework_design(height, symbol):
result = "Welcome to the Firework Design Creator!"
result += "\n\n🎆 Your firework is ready! 🎆\n\n"
# Create upper half of firework
for i in range(1, height + 1):
result += " " * (height - i) + symbol * (2 * i - 1) + "\n"
# Create lower half of firework
for i in range(height - 1, 0, -1):
result += " " * (height - i) + symbol * (2 * i - 1)
if i > 1:
result += "\n"
return result
output = firework_design(3,'*')
print(output)
Welcome to the Firework Design Creator! 🎆 Your firework is ready! 🎆 * *** ***** *** *
In [ ]: