Transcripts
1. 01 Budget tracker introduction: In this Python practice, we want to create
a budget tracker. So user can add their income, at their expense, and they
can see their balance. They can see the transactions, and our project will save all the files as a JSON as will, and it will load
it automatically as will. So let's begin.
2. 02 add income function documentation: Not for creating
or budget tracker. I want to go to
desktop and in here, create a new folder and I
want to call it Budget. Tracker, right? And let's just put
it aside like this. Go to VS code. Let me zoom in
here a little bit. Go here, click on Open
Folder, go to desktop, budget tracker, headsletFolder, and know we are
inside that folder. Now, I want to create
a new file either, I can click in here or click in here to
create a new file, and I can tell it to
create a Python file. And with that, we can
control to save it, and we can name it something. For example, budget
Tracker, right? And you can hit save and
you can see it will put the PY at the end of that budget tracker.
Let me close this one. Now in here, first thing
that I want to do, I want to create a
variable to save all the incomes and expenses. And for doing that,
I want to use a dictionary because it's really easy to work
with a dictionary, and we can save that dictionary
as a JSON file as well. That's why we use
dictionary a lot. I want to call this one
budget data, right? This is the name
of the variable, and I want it to be a dictionary that has some key value pair. First, key, I want it
to be income, right? And the value of it, I want it to be empty list. After that, the next
pair of key value, the key I want it to be
expenses and the value of it, I want it to be
empty list as well. Let's just say incomes, right? That's I think better, right? Now we have a variable that we can save all the transactions, all the income and
expenses there. Now with that done,
I want to create a function for adding incomes. So for doing that, we
want to say death, add income, right, open
and close parenthesis. And whenever we want
to add a income, we need to tell it
how much is it? So let's just put amount there. What is the amount
of this income? After that, we want them to
pass a description as well. So I will pass another variable, input, and I will
call it description. That is our input. After that, the colon and in here, I want to show you a new way
of documenting a function. For doing that, again, we are using three
double quotation on left side and three double
quotation on the right side. And we can have it
in multiple line. And for this
documenting to work, it needs to be on
different line, right? On the first line, I want to explain what
these function do. For example, add income
transaction to the budget, right? Next, we want to
explain the arguments, right, the inputs, right? These arguments or inputs. For doing that, we
say arcs after that, the colon and go to the
next line, head tab. So you will be indented a
little bit for space, right? And in here, I want
to say the amount is the first variable, first input, and the type
of it is float, right? And after that, we can give it the description of this variable with the colon and after that, the amount of money
that you earned, right? No, for the next input,
this description. So let's just put it like this
copy and paste it in here. The type of it, I
want to put it inside a open and close parenss
and the type of it istR. This way of documenting
your functions is really good with companies, right when you want to
get hired for a job, this way of documenting your functions will
affect your interview. Now, in here, the
description is a string. I want to say explain. Where is the source of
this income, right? And at the ending here, we can tell it what this
ad income due at the end. I want to say it will
print success message and save the income
Inside budget data. That's it. Let's just go
here and use this ad income. If you hover over it, no, you can see how
beautiful it is. It says, add income
transaction to the budget, and it will explain the
arguments or the inputs, the amount is float and the amount of money that you
earn and the description, the type of it is a string, and it says, explain where is
the source of this income. After that, it will tell
you that it is printing success message and save the income inside
the budget data. That's it. No, we did create really good documentation
for over function.
3. 03 transaction dictionary: No, with this amount that
description that we have, we want to create another
dictionary to save it inside this budget data
incomes list, right? So let's see how we can do that. For doing that, I will
create a variable and I want to call it
transaction, right? And I want it to be equal
to a dictionary, right? And inside this dictionary, I want to save some stuff. For example, the first key I
want it to be amount, right, and the value of it, I want it to be amount, variable that we get
from input, right? The next key I want it to
be description, right? And the value of it, I want it to be the description that we get from
the input, right? Know with that then
what we can do, we can say budget data and
we get the list of incomes, so choose the incomes
there, and after that, we can append to
its list, right? The transaction. So we put transaction
there, right? Now with that done, what I want to do, I want
to use this function. So let's just go here
and say add income. And for the first one, let's just say the
amount is 2000, right? And for the description, I wanted to say it is
from salary, right? And next, let's just add
another income, and in here, I want to say we have 500 from the YouTube,
right? That's it. Now, let's just show that with the print,
we can show that. We can say print budget data to see if the information
is saved there or not. So for testing that, go to here, go to terminal and
create a new terminal. In here, I want to
say PY, head tab, and it will put
the budget tracker that we wide there head inter. Now, you can see it did show us the budget data that is just a dictionary
that the first key is incomes and the value of that key is a list
of transactions that each one of these transaction is another dictionary that
is just a key value pair. And you can see the
amount is 2000. The description is salary
and the next transaction, the amount is 500 and
description is YouTube. Now, we are saving
some income as a transaction inside
our budget data.
4. 04 Get current date: No next thing that I want to do. Whenever we add income, I want to save the
date in there as well when this income
happen, right? So for doing that,
we need a library. So in here, I will
say from date, time, import, date time. Now with this date time, we can add the date to
this transaction as well. Now with that imported, I want to create a function
for getting the current date. And for doing that,
I want to say the, get current date, right? With that, it should
return a date, right? And this function will
return a date, right, current date because in here, we didn't have
anything for return, and we couldn't
document the return. In here, we have a return, and I want to show you how you
can document that as well. So tree double
quotation in here. In separate lines like this. And first, I want to say it is returning the
current date, right? And after that because it's
just returning something, I will say returns. After that, the colon
and in here head tab, first, I will specify the
type that it will return. It will return a string. This is the variable type
that it will return. After that, the colon. For the description of it, I will say current date, right? No with that done, let's just use it to see if the documentation is
working fine or not. Get current date. If
you hover over it, you can see return
the current date and the type of returns
is a CR or a string, and it will return
the current date. Now you know how
you can document a function that can
return something. Now with that done, I want to return date time dot n, right? So this will give
us current time. After that, we
want to format it. We say SDR F, time, string format time, for example, and in there, we should tell it how it
should show it to us, right? In here, first, I will say, show me the year. After that, choose
a symbol like this. After that, we say, show me month and after that, show me the day. You can decide what
you want to put in there with this person Y, I will give you the year, with this person M, it will give you the month
and with this person D, it will give you the day, right? With this, we are telling
this datetime library or function how to format the
date and return it to us. Know with that done,
we can use get current date inside
or at income. So in here inside
this transaction, we want to add another
key value pair, and I want to call it date. And for the value of it, I can just say get current
date because it is a function, so it need open
and close parents. It will return the
current date as a string, and it will be saved inside this transaction
dictionary, right? Know it that down
control is to save. Now if you run, you can
see the incomes has a list of transaction that each one of these transaction
has a date as well. You can see it. Beautiful. Each one of them has the date that this transaction
happened as well.
5. 05 Save budgets: Know that we are saving the transactions inside
the budget data, we need to save it
inside the JSON file. So for doing that, first, we need to import the JSON. So we say import JSON, right. After that, I want to
create a function up here for saving budget data. So in here, I will say
deaf, save budget, right? Open and close prances. After that, colon, now in here. My recommendation is to use documentation to all of
your function always, and it will be good
in your resume. But because I'm
creating a course, it will take too
much time to create documentation for
all the functions. So that's why in here,
I won't do that. First, I will say try
because we want to catch whatever error that
it throw at us, right, with open, right, and we need to either
open and create a file. So in here, I will
say budgets dot JSON. And the open text method, I want to use W. And
this W will check. If there is this file
inside this folder, it will open it. But if it's not there, it
will create it, right? It is in we mode. And we can tell
Python to give this to me as a variable name. For example, file, you can
call this whatever you want. Now, in here, we can
say json dot dump. Right? And we can say, dump the budget data
inside a file. That's it. It will dump it, but we want to get the
exception in here. So if it can't create it or it can't open it or whatever
error that will happen, this except will happen, and I want to get all the
error at the same time, so I will use
exception this time, and I will tell Python
to give this error, whatever error that can
happen and will happen as a variable that I can
call it E, E, right? After that, we can use
a print to show that. In here, let's
just use F string. I will say error, right, a col and after that, after
that, a cool bracket. And in here, we want to show the E or all the errors
that can happen, right? And that's it. With this save budget, we are saving the budget data. Let's see how we can use it. After we add in the income or transaction
to the budget data, we can use safe budget
function in here. And after that, we
can use a print to tell users that the income
was saved successfully. So in here, I want to use F
string income of Cl bracket. And in here, I want
to show the amount added Success fully, right? That's it. Control to save. No. If we run, it will create a
budget dot JSON. And if you open it, you can see the exact same thing that
we are showing in here. It is saved inside
budget dot JSON. And you can see we have
the amount that is 2000 from salary, and
this is the date. And if you go forward, you can see there is another
transaction in here. Now, we have a function that is saving the budget data
inside a JSON file.
6. 06 Load budgets: Know that we are saving
our budget in a file. Whenever we run our application, again, we need to load it. So for doing that,
after this save budget, I want to create a
load budget as well. So DF load budgets, open and close prances,
and after that, a colon and no in here because we want to update the budget data first thing
that we want to do, we want to declare the
budget data as global. So we say global budget data, right and with that, no, if we change the budget
data inside this function, it will be updated in global
space or in here as well. It will be updated
everywhere, right? Like we did it up
here for saving, we want to say Troy
and after that, we want to say wet, open, open and close parents, and know the name of this file. Let's just copy all of them. And paste it over here
because we want to open this file in read mode. So put R in there. By default, it is R, but it's safe to
put the R there. After that, we can
tell Python to give me this as the file. You can call it
whatever you want. Now with this, we can
say JSON dot load, and we give it the file. So it will load that for us, and now we can save it
inside the budget data. So search for budget data. It is equal to json dot load. Now, we should accept
the errors, right? So in here, first,
except that I want to do is file not found error. File not found error will
happen whenever we try to open a file and it won't open
because it doesn't exist. If it doesn't exist, we can use save budget
to create it, right? But for the rest of the
errors that can happen, we can say except. After that, get all
the exceptions, and after that,
we can tell it to give this to me as a variable. We can call it E. And after
that, we can show that. We can say print, use F string, and we say error. And with that, we show
the error itself, we put in it there, right? No, we have the load budgets. We know that from last Video, we saved some transaction
inside the incomes. No, we don't need
to do it again, so delete these ones and know if you run, let's
see what will happen. You can see inside the budget
data, there is nothing. But if we use load budgets, what will happen if we run, you can see it will load
all the budget data, and we can see it over here. We are loading it correctly.
7. 07 Add expense: No next thing that
we want to do, we want to be able
to add the expenses, and it's really easy. We can just create
our function in here, add expense, right? And for the input of it, like we have it for add income, we can just copy it from here, the amount and
description, right? Paste it over here. The
art copy and pasting in Python is really important
because it makes you faster in developing things. We can just copy all of these
and paste it over here, right, and change some stuff. For example, the transaction,
we don't need to change it. The budget data
instead of incomes, we want to save it inside
the expenses, right? Put the expenses there. So I can just copy it from here, the expenses key, right? And put it over here, and we append the transaction. There. After that,
we save the budget. And in here instead of income, we say expense of amount
added successfully, right? Now, with that,
let's just test it. I don't want to print it
for no, what I want to do. I want to add expense, right? The amount, let's just say
$20 for Internet, right? Just add another
expense, add expense. Let's just say $50 for shopping. For example, right? After that, add another expense, $400 for
rent, for example, right? This is all of our expenses. Now, let's just run to see
if it's working fine or not. Expenses of 20
added successfully, expenses of 50
added successfully. And if you go to budget
dot JSON, if you go, you can see the expenses has a list of transaction inside it. That again, like before, it has amount description
and data as well, for all three of them, you can see how easy we are
creating a budget tracker, know that we add all of these. We don't need them, right? No, it's time to
give user the option to add expenses and incomes and be able to see the balance and see the transactions as well. Let's see
how we can do that.
8. 08 Show menu: No next thing that I want to do. I want to show a menu so
user can choose something. So in here, I will
create a function. Let me say def, show menu. After that, open
and close branches. And in there, first and first, I want to use a print, right? Say backend, so it will
go to the new line. And after that, I will
use some equal sign. I will show the name of over application that is
budget. Tracker. After that, add some
equal sign after that. So it looks more
beautiful, right? After that, I will show the options with a
print right in here. I will say one dot
at income, right. After that, another
one, we say print, two dot at expense. After that, again, I
will use another print. And in here, I will say
T dot, view transaction. Next, let's just say print. In there four dot, view balance, and next, print. This one, five dot, exit. That's it. Now, we
are giving the user some option and we
can run that in here, show menu, use that function. Now, if you run
what will happen, let me make this bigger. You can see first, it says
budget tracker and after that, it will give us some options. Know it that we can get a input from user
and based on that, decide what we want to do. But I want to create
another function for getting user input. Let's say we can do that next
9. 09 get user choice: Know we have some options
that user can choose. And for choosing one
of these options, I want to create a function
for user choice, right? So in here, I will say Div, get user choice, and open and close prances
and after that, a column. No inside this function, I want to use a vile True. So if they didn't choose
something correctly, it will go back and
ask them again, right? After that, I want
to use a Troy. So we make sure
with this Troy that they don't put something that
shouldn't be there, right? I will use input to get
a choice from user, and in there, I will
say, enter your choice. And I will give
them a hint that it is from one, two, five, right? After that colon and after
that in a space, no, they will put a value 1-5, and this input will
give us a string, and we need to convert
it to a integer. So we'll say integer, int, and after that, open and close prances
around the input, and no we can save
it inside somewhere. So we can say choice is equal to this value that user
put in there, right? Now with that done,
we want to check. If the choice is 1-5,
you can return it. But if it's not, let
them choose again. So in here, we say F, choice. Was bigger or equal than one, and choice was less or equal. Then five, in that case, return the choice, right? But in case of else, we can use a print, and in there, we can say, please write a
number between one, two, five, a dot at the end. No, we need to accept
this Troy, right? So in here, we say except we can use exceptions
in here as well. And after that, we can tell
Python to give this to us as a variable that is called E. You can name it
whatever you want. And in here, we say print error. Let's just use FS string
and show the E first, line and arrow after that
and tell them like this, please write a valid
number, right? Now with that done,
let's just use it. After showing the menu, we want to get the user choice. Let's see what will
happen Controls to save. Now, if you run, you
can see it says, budget track it will give us some option and it will
tell you enter your choice. If you put six, again, it says, please write a number 1-5, and we can choice again. And if you put N in
there, head inter, you can see it says error, invalid literal for
Int with base ten. After that, it
says, please write a valid number, and that's it. We can choose whatever we
want, for example, one, and our program will be finished and it will
return something. So we can use a printing here. To show that what they choose. I will give us a number, right? So if we choose, for example, four,
it will show four, and after that, it
will get out of the budget tracker application.
10. 10 get income from user: Know that we know what is the choice of the user,
let's just use it. In here, hotly all of this, we want to load the budgets. But in here, what I want to do I want to use Wil true, right? And in there, we want to
check the choices always. So we say Show
menu first, right. And after that, we get
the user choice, right? And we can say that
inside the viable. Let's just say choice
again in here, so it will be easier
to understand it. Now with this, we can
check the choice with a if I choice is equal to one. And because this
get user choice, it's giving us a integer, right? Because we convert
it to a integer. No, we can just say if
choice is equal to one, it's just a number, right? Choice one is for
adding income, right? So we need to get some
things from input. So we say input and in there, we say inter income amount, right after that colon
and after that in a space because this income amount
can be a float value. That's why we should say float to convert it
to a float, right? And with that, we can save
it inside a variable. This variable, I want
to call it amount. And now we want to do the
same for description. But for description,
it's easier. We say input and indu into this cryptan colon and
after that, a space. No, we can save it
inside a variable. Let's just call it
this crip Shan, right? It's equal to this. Now with that done, we have the amount
that user write, and we have the description
that user write as well. We can use add income
function to add that, right? So the amount, we can
pass the amount there. After that, the description, we can pass the
description there. Now with that done, it fill
add the income, right? Let's just test
that or if we run, you can see right no, we have two income. One is for salary and
one is for YouTube. Let's just say one in here. And no, it says
the income amount. Let's just say 1,200, right? Head inter, I will tell
you inter description. Let's just say day job or whatever you want
to put in there. No, you can see it
did added there. You can see if you go at
the end of the incomes, you can see amount is 1,200. The description is day job, and the date is this. So again, we can add more. Add another income
so income amount, let's just say 500 and the description from
the father, right. And with that, if
you look at it, you can see there is 500 amount
from father on this date. No, we don't add income, right? User can add income. No, I want to give
you a challenge. You try to implement
adding expenses. You try to do that. We
will do it next video.
11. 11 Get expenses from user: No we want to give the user the choice to
add a expense, right? For doing that,
again, we go here, we can copy and paste
all of these, right? And in here, we can say if if and paste all
of that in here. This time, we want to
say if the choice was to inter expense amount and
after that inter description. And after that, the
function that you want to use is at expense. So just changing some
stuff, it will work fine. Now, if you run and
look at the expenses, you can see the last
of them is rent. No, in here, let's just put
two in there head inter. No, it says, Inter
expense amount. Let's just say 200 head inter. After that, the description
for these 200 child, for example, head inter, no you can see the
expense is added there 200 was taken by the child
in this date, right? So we did add it successfully. No next thing that I want to do whenever we put
five in there, we want to exit out
of the execution, but it's not doing that. Let's just use Control C to
get out of this execution. Now go to budget
tracker in here, and I want to use
LIF again, L I. And if the choice was equal
to five, what we want to do? We want to exit. Out
of the execution. That's it. It is
just a function. Now, if you run and put
five in their head inter, you can see it did get
out of the execution. No, if we go to option,
let's see what we should do. We should create a
function that can view all the transaction
incomes and expenses, and we will do it in next
12. 12 Calculate balance: No for showing all the
transactions to the user, if they choose it, we need to create some functions
to do that. For doing that, before
this load budget, what I want to do I want
to create a function. For example, this one, I
want to say total income. So this function will get all the incomes and it
will add them together, and it will show
it to us, right? After that, the
column know in here, we need to create a variable
to save the total income. And for doing that,
I want to say total income value is
equal to zero, right? And after that, I want
to use a for loop. What I want to do, I want to get all the transactions that
is inside the income. We have a key income that
for the value of it, we have a list of transactions, and we want to get
that list, right? So we say for transaction
in budget data, and we want to get the
incomes from budget data. So we need the key
of incomes, right? This is the key for
all the incomes, and we want to
paste it over here. Now, it will give us
all the transactions, and for getting the
transactions amount, we say transaction, right, and how we can get it with
the key amount, right? So we copy this key and
we paste it over here. Now with that, it will
give us the amount, and we want to add it
to total income value. So we say total income value is plus equal to this
transaction amount, right, this income amount. Now, when this four loop
finishes, what we want to do, we want to return the total
income value. That's it. Now, let's just use that. For using that, after
loading the budget, I want to use a print, and what I want to show, I want to show the total income, right, what it is returning, total income function, and we want to show what this
total income returning. Let's just go to budget
JSON We have 2000 in here. We have 500 in here
and after that, we have 1,200 in here. After that, we have 500 in here. So we have a lot of them, right? So no licious run. Make sure you save
after that run, and you can see it says 4,200
is the total income, right? No, we want to do the same
for total expenses, right? So we can just copy and
paste all of these, paste it down here. But this time we want to
say total expenses, right? And after that, change the
income to pens expense, right? And we want to get
all the transactions in the budget data expenses. So we need to copy the
key of the expenses. Let's just go and go, and you can see it over here, Controll to copy it. And now we can just
paste it over here. Now, we are getting
all the expenses from over budget data. No, I want to copy this one, paste it over here, and here. No, we have a function that will calculate total expenses. For showing that, let me
change this to Fstring. So I will say F after
that double quotation. I will say total income. After that colon and
with the curly bracket, I can show total income. This is a function. We need to use open and close
prances as well. Now after that, I want to
show D expenses as well, so we use the FSString in here, we say total XPs after that, a colon and after that, a curry bracket and
we want to show total expenses because
it is a function. We need to open and
close parentheses. Now, in here, let's just had
five and run or code again. Now, you can see total income is 4,200 and total
expenses is this. So we are calculating
the total income that we had and total expenses. Now next thing that I want
to do I want to create a function to calculate
the balance, right? So in here, we can
say D balance, right? It is a function, and that's it. We want to return
the total income, what this total income
function gives us minus or subtracted
by total expenses. This is another
function as well. So what will happen
in here first, it will calculate
the total income, and it will subtract
it by total expenses, and it will return the result. No, we can show that, right? We can say print,
use a FS string. We say balance after
that to colon, and we can use balance in here. Balance function because
this is a function. I need a open and close prances. Now, let's put five in here
and run or code again. You can see it says
total income 4,200, total expenses is this,
and balance is this. Let's check that with
the calculator in here. 4,200 minus 670, and
you can see 3530, 3530. Now, we are calculating
the total income, total expenses, and
the balance as well, how much money we have left.
13. 13 View transactions: No for showing all
the transactions. I want to create a
function for that as well. So in here, I will say de
view transac shins, right? This is a function, so it need to open and
close parenthesis. And in here, first and first,
I want to use a print. And in here, I want to say
a back slash in first. So it will go to the next line. After that, some equal sign
or transacens after that, some more equal sign. Let me make some space. Next, I want to use
a print to say, I'm going to show the incomes. So in here, first, again, I will create a new line. I will create a space between
this one and this one, and I will say, I want to show the incomes that colon, right? Next, we can show
all the incomes. And for doing that, I
will use a four loop for trans action in budget data. And with that, we want
to get all the incomes. So in here, we need to copy the incomes key,
this one, right? So we can get the list of
transactions, right? That's it. Now for each transaction, I want to use a print. And in here, I want
to use F string. First, I want to show the date. That's why I will say
transaction. Show the date. So we need to copy this key
from here to here like this. After that, I want to add a
line in here and after that, I want to show the
description, right? So for that, again,
we say transaction. And this time, what
we want to get, we want to get the description. So Control S copy it from
here and paste it over here. No, after that, I want to
add a colon and after that, a plus after that dollar sign. No with this, I want
to show the amount. So in here, open and close curly bracket, show
the transaction. Amount, right? So let's
just copy the amount from here and paste
it over here. That's it. Beautiful, right? Now, let's just test that out. If we go here after
the load budget, what I want to do I want
to use view transactions. It is a function, so you should do it like this. Let's just run now. We say PY, budget
head tab again, so it will go to
PY one head inter. Now if we go up, you can see the incomes, right? The date after that line, after that, it will tell us the description,
and after that, it will tell us how many dollar it did add to our
balance, right? After that, it
showed total income, total expense, and
balance, right? So everything is good. But we want to show more. We want to show the
expenses as well. So what I want to do, I
want to copy all of these, Cos to copy it and know in here, paste it, and no we want
to show the expenses. So we say expenses. And in here, we want to
get all the transactions that is in budget data
expenses, not income, right? So let's just go here, find the expenses key in here, control seat copy it
and paste it over here. Now with that, we get
all the transactions inside the budget data expenses. And after that, the
only thing that I want to change in here
from this plus, I want to use minus, right? Beautiful. Now with that done, I did forget to put BN in here. So make sure you
put B N in here. Don't delete this
because it won't look that much good
if you don't do that. And now let's just
test it one more time. If we run, you can see first, it will show all the incomes. Beautiful. And after that, it will show all the
expenses, right? No next thing. I don't want to do these kind of things, right? I can just delete it, and I want to do it inside this view all the transactions. So in here, first, I want to say print. After that, I want to say By
so it will go to new line. And in here, I want to say
summary, right? That's it. Control is to save.
Now, in here, we want to show everything
like total income, total expense, and the balance, right? So we say print. I want to use F
string say total. Income. After that, a
colon and after that, let's just say dollar
sign, and after that, open and close curly bracket, and I want to show total income, right, the function that
we create together. No, I want to copy
and paste this. On the next line, I want to show the total expenses, right? And in se of total income, I want to say total
expenses, right? Cool. That is finished, as well. Now I want to show the balance. So in here, again, use FS
string, current balance. After that, a colon
and after that, $1 sign, and after that, open and close curling bracket. And we want to use
balance function that we create together, right? Beautiful. Everything
is beautiful. Now, let's just test that put
five in there head inter. Let's just run again.
And now you can see. Let me make this bigger because it looks much better this way. All the transactions,
income is these ones, beautiful, and the expenses
are this one, beautiful. And after that, we have a
summary of total income, total expenses, and
current balance. No, everything looks really beautiful for the view,
all the transactions. No, we need to go
to the choices, and whenever they want, we want to show the transaction. Whenever they want, we want
to show the balance, right? Let's see how we
can do that next
14. 14 show current balance: No, we want to get another
choice of our user. So in here, we check. If they choose three,
for example, we say, L if choice was equal
to three, right? In that case, what we should do. We go up, we should view
the transactions, right? So let's just go
down, and in here, we use function that is
called view transactions, and that's it. Easy, right? Now, let's just
use another LI and check the choice if it is
equal to four and after that, in here, what we want to
do we should show balance, so we say print and in here, use a FS string. First, I want to have
a back slash in, so it will go to the new
line current balance, colon and after that, $1 sign after that clip bracket and we want to use the
balance function there. Whatever it will return,
we will show it. Now, let's just test that out. In here, let's just put
five in there, head enter. Let's just run it again. Now, let me make this bigger so you can see
everything better. We want to view
the transactions. So put three run, and now you can see
all the transactions. Incomes are here,
expenses are here. The summary are here,
beautiful, right? Now, if you just want
to see the balance, we put four in their head inter, and now you can see current
balance is this one. So everything is working fine. Now, let's just add
another income in here, put one in there,
inter income amount. Let's just say 250
and after that, let's just say from
stock market, right? Whatever you want to
put, you can do it. Now, with that, let's just
see all the transaction. Put three in there, head inter. Now, you can see in the income, we have stock market, 250 added to us, and no, the total income
is more than before, and we have more balance, right? So, no, we put five in
there and we get out. Congratulations. I'm
finishing this project.