A Python variable is a maintained memory location to store values. In other words, a variable in a python program saves data and returns it to the computer for processing.
• Creating variables in Python:- write the variable name on the left side of = and the value on the right side. There is no special process for defining the type or genre of the variable. See examples below.
>>> a=10
>>> b=12.2
>>> c="Welcome to The Code Panda"
• Reading variables in Python:- Just simply call or print them. You can use your variable at any place in the current program. Note: variable must be defined first before using them.
>>> print(a)
10
>>> print(b)
12.2
>>> print(c)
'Welcome to The Code Panda'
How to Choose Name for your Variable
- variable names in Python can be of any length.
- variable names can be any combination of alphabet, symbols, digits. Forex: name_1, person@name
- words should be separated by an underscore(_), not spaces. ex: first_name
- You can also use the Camel version of words like firstName or new phone number.
How to not Choose Name for your Variable
- any word starting from a digit or special symbol can't be used as the variable name. Forex: 1name, @call, $person1
- Avoid using keywords as a variable name like class or and etc.
- Avoid using built-in func's name as a variable name like sum or max etc.
- You can identify built-in or keywords when a word changes its color in Python IDLE.
-----------------------------------------------------------------------------------------------------------------------------
BE MY FRIEND:
🌍Check my website: https://thecodepanda.in/
📸Add me on Instagram: https://www.instagram.com/thecodepanda.in
📕 Add me on Facebook: https://www.facebook.com/thecodepanda.in
🎴 Add me on Tumblr: https://thecodepanda.tumblr.com/
ABOUT MY CHANNEL:
TheCodePanda is a Free initiative for kids and all beginners to learn Coding in a Very friendly and Interactive way. Our Complete Team is dedicated to providing Free, Quality, and Easy ways to learn Programming for everyone.
Support Us & Follow Us.
#programming #thecodepanda #codingforfree #thecodepanda #coding #code
Subscribe here to see more of my videos in your feed!
https://www.youtube.com/channel/UCERr...
If you have any question/Query, please mention in your comment box.
-----------------------------------------------------------------------------------------------------------------------------
Comments
Post a Comment