-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathproblem_2.py
26 lines (20 loc) · 948 Bytes
/
problem_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 11:39:16 2025
@author: Somaia
--- 2: Performing Calculations with Variables ---
Now that you’ve set up a savings variable, let’s take it a step further and use it to explore some calculations.
Imagine you’re planning to save $10 every month. How much money will you have saved in four months? Rather than working with the numbers directly, let’s use variables to perform the calculation.
Instructions
1. Create a variable called monthly_savings and assign it the value 10.
2. Define another variable, num_months, and set its value to 4.
3. Multiply monthly_savings by num_months and store the result in a variable called new_savings.
4. Finally, display the value of new_savings using the print() function.
"""
# Assign values to variables
monthly_savings = 10
num_months = 4
# Perform the calculation
new_savings = monthly_savings * num_months
# Print the result
print(new_savings)