Introduction to Variables - Python 3 Beginner Programming Part 5

preview_player
Показать описание
Part 5 of Python 3 Programming.

Today we'll be taking a look at Variables! A very fundamental concept in Programming. You can imagine variables as a way of naming a value and then to use that value you simply call it by its name.

I forgot to mention in the video that when naming a variable, there are some guidelines you need to follow, You:

Can
- Start variables with lowercase or uppercase
- Have single letter variable names
- Use underscores at the start, end or middle (e.g var_name, _var_name, var_name_)
- Include numbers in the middle of your variable name (e.g. var_name_1, var_1_name, var1111)

Can't
- Start a variable name with a number (e.g. 1_var, 1num)
- Have single number variables (e.g. 0 = "this", 1 = "r")
- Have a variable name that is already occupied by the python syntax (e.g. print = "ssd", includes operators too, + = 22)

There are quite a few more combinations but this is just the general idea on naming variables in Python 3. Also generally when creating long variable names, you'd want to represent a space with an underscore. E.g. a_really_long_variable_name = "small".

Have a look at PEP8 for Python, this is the naming convention that python uses for their inbuilt standard libraries.

Enjoy!
Let me know down the comments if there's anything.
Рекомендации по теме
Комментарии
Автор

How did you make a comment hash at once for many lines?
Thank you for your tutorials they are great

Karimozoro
join shbcf.ru