Variables, Variable class, and F string tutorial.
gjirtngisnt (8)

Hello! This tutorial is for those who are new to python and have heard this term before but don't know what it means.
What is a Variable?
A variable is something that changes in your python program. For example, a variable could be the score in a game, your health in a game, your amount of lives in a game, or even letter/word data.
How to assign and edit variables:
To assign an integer(or a numeric variable), you should type something in this format, but use your own variable name and value. varname = 5. this is a valid value, and python will process it.
Boolean(true or false):
String(word/letter variable):
rep = 'ReP'
float(decimal number):
d = 4325343254.354356452642
to edit(you can only edit integers/FLOATS), you use += or -=.
to edit a string, you have to reassign the variable like so:
a = 'a'
a = 'b'
F strings are the best (in my opinion) way to print variable values. to do this, you use the f string format. Here is what it looks like: print(f'{your_var} is the value of your_var!') The output would be your_var value.
If you enjoyed or were helped by this, please upvote!! Thanks.

You are viewing a single comment. View All
gjirtngisnt (8)

@Wumi4 Thanks for your help! Sorry I did not include the information you mentioned. This is the first tutorial I've ever done. Thank you for your feedback :).