In Python it's important to know that it differs from other languages in the following ways:
True / False: capitalized!!!
There's no && for and (like in c++) and no || for or (like in c++)
Before we move on, we need to think of some actual real world use cases...
You have to be between a certain height to ride a ride
You can't be a teenager to do something
You have to travel faster or slower than a specific speed or you may be ticketed
You need to travel in between a certain speed
There's no point learning what this is, if you don't know how to use it (or why)
Are you able to ride a specific ride?
We use AND here
What does this check to see??
Do you qualify for a student discount??
We use OR here
What conditions need to be met??
The Millennium Falcon needs to leave Tatooine, but it has to meet several conditions before takeoff. The program checks fuel levels, hyperdrive functionality, and if the crew is ready.
The Millennium Falcon can only take off if:
Fuel Level: The Falcon has enough fuel (at least 75%).
Hyperdrive Status: The hyperdrive is functional.
Crew Readiness: The crew is ready for departure.
Each of these checks will require user input and a corresponding message based on whether the condition is met.
Prompt the user to input:
The Falcon's current fuel level (as a percentage from 0-100).
Whether the hyperdrive is functional (yes or no).
Whether the crew is ready (yes or no).
Perform Checks:
Use if/else statements to check each condition.
Print messages for each check:
✅ if the condition is met.
🚫 if the condition is not met.
Final Decision:
Use a final COMPOUND if statement (with and/or) to decide:
If all conditions are met: Print a success message and allow the Falcon to take off.
If any condition fails: Print an error message and abort the takeoff.
Countdown To Takeoff
Add a countdown message before printing the final status.
Use a series of print() and sleep( ) statements to simulate the countdown (e.g., "3... 2... 1... Lift-off!").
Special Mission Check
Add a VIP passenger check
Ask if Princess Leia is on board (yes or no)
Check the passenger manifest to see if she is...
If she is on board, print a special message: "This mission is top priority! Protect the Princess!"
Calculate Fuel Efficiency
Let the user input the distance to the next planet (in light-years).
Print how much fuel is needed (e.g., distance * 2 fuel units).
You will need a variable which holds the milennium falcon's max fuel, and calculate how much you have based on the % fuel remaining which the user input!
Let them know if the fuel level is sufficient to complete the journey
Cargo Weight / Readiness Check:
Prompt user to enter in weight of cargo, and determine if it is under the max weight the falcon can carry
If it is too much, remove the appropriate amount of weight, and notify the user that you are dumping cargo
Prompt to see if it is secured, which is a requirement for launch