Variable variable variable.

0 13
Avatar for Vernardo
1 year ago

Python3 Article #0.5

How's your day everyone?

Today I will be talking about what is variable in programming jargon we will be using Python as per usual and without further unnecessary words let's jump in.

Variable.

A variable is like a glass holding water or anything related to liquid If it doesn't make sense now I hope we will understand it in the code below.

glass = 'water'
glass_2 = 'juice'
glass_3 = 'softdrinks'

print('What is inside glass one? %s ' % glass)
print('What is inside glass two? %s ' % glass_2)
print('What is inside glass three? %s ' % glass_3)

We can use variables such as name, place, event, and words except for numbers we can't also use special symbols except underscore _ and hashtag # is a comment in python.

#string formatting for integers object.

_jan_age = 20
_gener_age = 30
_mario_age = 40

print('What is jan age ? %d'% _jan_age)
print('What is gener age ? %d'% _gener_age)
print('What is mario age ? %d'% _mario_age)

# name error variable in python below

1jan_age = 10
gener_age_^ = 20
`mario`age = 30

# if you use variable numbers and special symbols it will throw a SyntaxError
Sponsors of Vernardo
empty
empty
empty

Using what we've all learned so far.

# we can start with a comment about the program and what it does.

my_name = 'PanPanHam' # a variable holding my name as an object.
my_age = 28           # a variable holding my name as an object.
my_pet_name = 'lycanthrope'   # a variable holding my pet name as an object.
my_pet_age = 4                # a variable holding my pet age as an object.

# Using string formating we will print all of the information above. if it is integer
# we will use %d if it is string we will use %s

print('My name is %s I am %d years old I have a pet his name is %s and he is %d years old' % (my_name, my_age, my_pet_name, my_pet_age))

Remember.

I am not a professional programmer or do I hold any bragging rights for that if there's anything that can be corrected in this tutorial please leave a comment in the section below.

I can advise anyone whose following this tutorial to remember that understanding the concept behind it is easy once you grasp the fundamental of strings and integers the next article will be easy to understand however you must still do your own research to further your knowledge about strings and integers in general as I can't provide all much information about it while just writing a passion about programming in this specific language.

Lead Image: Python Logo


My other social media where you can contact me for anything.

NoiseCash: noise.cash/@Vernardo

Telegram: PanPanHam

1
$ 0.00
Avatar for Vernardo
1 year ago

Comments