✅ Code to Test My Python Setup¶
This is a simple script I wrote to verify that my Python environment is correctly set up for the BCG Python course.
🧠 Code Explanation¶
-
num_of_apples = 10
Declares a variable to represent the number of apples. -
num_of_oranges = 20
Declares a variable to represent the number of oranges. -
sum_apples_oranges = num_of_apples + num_of_oranges
Calculates the total number of fruits by adding apples and oranges, and stores the result in a new variable.
In [3]:
num_of_apples = 10
num_of_oranges = 20
sum_apples_oranges = num_of_apples + num_of_oranges
str_apples_oranges = f"The number of apples I have are {num_of_apples} and the number of oranges I have are {num_of_oranges}."
str_total = f"So the total number of apples and oranges I have are {sum_apples_oranges}."
print(str_apples_oranges)
print(str_total)
The number of apples I have are 10 and the number of oranges I have are 20. So the total number of apples and oranges I have are 30.