“If you mess up, the rocket goes boom. If you succeed, the Minions get more bananas. Choose wisely.”
Integers are positive or negative whole numbers. They do NOT have a fraction or decimal part.
Think WHOLE BANANAS! No Leftover Pieces!!
FLOATS are numbers with a decimal part.
NOTE: The decimal portion could be ZERO
Yes... We have something called complex!
A complex number in Python is
a built-in numeric data type that represents numbers with both a real and an imaginary part. It is written in the form a + bj, where a is the real part, b is the imaginary part, and j is the imaginary unit (the square root of -1).
We're NOT covering complex in this class!!! Whew!!
my_num = 3.0 * 2
my_type = type(my_num)
print(my_type)
This is something that tells you what TYPE the OBJECT is. It works on almost all variables. In our case, we want to see if we get an integer or float!! It makes a HUGE DIFFERENCE Sometimes!
+ (addition)
- (subtraction)
* (multiplication)
/ (division)
No matter what type, you can add, subtract, multiply, and divide numbers. Remember, they SHOULD be stored in a variable!!
THERE'S A SHORTCUT... You can do the math in the print!!
Gru’s Mega-Ray doesn’t just add or multiply energy. It powers up by multiplying itself over and over.
2 ** 3 → 2 × 2 × 2 = 8
5 ** 2 → 5 × 5 = 25
10 ** 0 → always 1 (no power, just the switch)
This operator answers the question: “How many full boxes can I pack?”
25 // 6 = 4 (6 fits into 25 four full times)
19 // 4 = 4 (4 fits into 19 four times, but not fully the 5th time)
Picture Kevin loading crates: he doesn’t care about leftovers, just full crates.
This operator gives you the leftovers after dividing.
25 % 6 = 1 (1 banana rolling around after filling crates of 6)
19 % 4 = 3 (3 bananas left loose after packing groups of 4)
10 % 2 = 0 (nothing left — perfect division!)
% is the “oops, what’s still on the floor” operator.
Welcome, Agent! You’ve been selected to help Gru and the Minions in their latest experiment: mastering the art of numbers. But this time, it's a special mission. You’re going to be the mastermind behind the code that controls the lab's most important machines—like the rocket launcher for the moon launch (Don’t ask questions!)—and the Minions need your help with some basic operations.
Get ready to use integers and floats to make everything run smoothly. The Minions might be silly, but they know their numbers are the key to success. You’ll be creating mathematical magic using addition, subtraction, multiplication, division, power, and even some quirky things like modulo!
Your Task is to try ALL of the operators on both INTEGERS and FLOATS! And as a second part, you have to try these on Integers and Floats TOGETHER!!!! Let's Try and See what the Difference is!
For all the operators, you need to:
Add/Sub/Mult/Divide/Mod/Floor Divide/Power 1 of each (an int and a float)
You must also output WHAT TYPE THE RESULT IS!!
Make Your Output SNAZZY!!! Use formatting and String Methods!
Gru’s Freeze-Ray is acting weird. Every time a Minion cranks the dial, the ray doesn’t just add a little more power — it doubles and doubles again. That’s how Python’s ** operator works: it raises numbers to a power.
NOTE:
The dial starts at 0 (minimum), and the Minions want to test it all the way up to 8.
Gru demands a clean chart so he can see how fast the power grows.
Gru only has 8 bananas today (budget cuts, don’t ask). The Minions still insist on splitting them in different group sizes. The % operator (modulus) tells us what’s left over after dividing evenly.
Kevin’s challenge: divide 8 bananas among 1 through 8 Minions and record the leftovers each time and give Gru a Chart that shows it!!
“MINIONS! We are testing the O.O.O.—Order Of Operations—so nobody accidentally divides the moon by zero again. Use digits 0–9 (don’t repeat digits within a single problem), and hit these targets:
21, 36, 50, 45, 62, 101
Make it flashy. Print your math statement, the result, and the digits you used. Bonus bananas if you:
Use at least 3 digits (no repeats within that one problem).
Any one operator (+, -, *, /, //, %, **) can appear 0–3 times (not more).
Print the expression, the result, and the digits used.
Parentheses welcome. (Gru calls them “safety goggles.”)
Make a separate, ridiculous one-liner that uses all digits 0–9 exactly once.
The more digits per valid problem, the more bananas (points)
Here's a Sample Print of the activity output. Please note, all calculations in this sample are INCORRECT (so don't use them!!!).
Additionally, this print out is a bit complicated as I am using a LOT of string methods to do it. Please try and get it close, as you want to make sure you're not only doing PEMDAS and working with integers, but also STRING METHODS and EVERYTHING Else we've learned in PYTHON!!!