Value replacement for a variable | Python Episode 04 | SL Android

Channel:
Subscribers:
18,100
Published on ● Video Link: https://www.youtube.com/watch?v=AZqpxVAjfvU



Duration: 8:51
971 views
0


What is a Variable in Python?

A Python variable is a reserved memory location to store values. In other words, a variable in a python program gives data to the computer for processing.

Every value in Python has a datatype. Different data types in Python are Numbers, List, Tuple, Strings, Dictionary, etc. Variables can be declared by any name or even alphabets like a, aa, abc, etc.

In this tutorial, we will learn,

How to Declare and use a Variable

Re-declare a Variable

Concatenate Variables

Local & Global Variables

Delete a variable

How to Declare and use a Variable

Let see an example. We will declare variable "a" and print it.

a=100 print (a)

Re-declare a Variable

You can re-declare the variable even after you have declared it once.

Here we have variable initialized to f=0.

Later, we re-assign the variable f to value "guru99"



Python 2 Example

# Declare a variable and initialize it f = 0 print f # re-declaring the variable works f = 'guru99' print f

Python 3 Example

# Declare a variable and initialize it f = 0 print(f) # re-declaring the variable works f = 'guru99' print(f)

Concatenate Variables

Let's see whether you can concatenate different data types like string and number together. For example, we will concatenate "Guru" with the number "99".

Unlike Java, which concatenates number with string without declaring number as string, Python requires declaring the number as string otherwise it will show a TypeError



For the following code, you will get undefined output -

a="Guru" b = 99 print a+b

Once the integer is declared as string, it can concatenate both "Guru" + str("99")= "Guru99" in the output.

a="Guru" b = 99 print(a+str(b))



මෙතෙක් පලවූ සියලු වීඩියෝ මෙම post එක පහල දාලා තියෙනවා මුල ඉදලාම බලලා ඉගෙනගන්න.

Chanel එක subscribe කරලා සහයෝගය ලබාදෙන්න,අනිත් අයටත් බලන්න share කරන්න.

Episode 01 - python හැඳින්වීම
https://youtu.be/xwxauFsCYmk

Episode 02 - විචල්‍යන් (variables )
https://youtu.be/0OpPQ51v0hs

Episode 03 - විචල්‍ය නාමකරණය
https://youtu.be/5ESY5G6-NAU

Episode 04 - විචල්‍ය පැවරුම්
https://youtu.be/AZqpxVAjfvU

Episode 05 - print function
https://youtu.be/k18CYJPWm3E

Episode 06 - python Data types
https://youtu.be/9AjunP0EYy0

Episode 07 -input function in python
https://youtu.be/0xrIK1kbfok

Episode 08 - Python Comments
https://youtu.be/hh2eiYwON4o

Episode 09 -len Function in Python
https://youtu.be/vSkwUTjh97Y

Episode 10- sep & end in python
https://youtu.be/VUfBgzGYNkw

Episode 11 -index operator in python
https://youtu.be/7UyVUimLR04

Episode 12 -Slicing operator in python
https://youtu.be/a4Ss_7HJpyU

-~-~~-~~~-~~-~-
Please watch: "How to code a simple calculator ( Project 01) |C Programming සිංහල Tutorial Episode 25 |SL Android"
https://www.youtube.com/watch?v=A6nvSvDcsUA
-~-~~-~~~-~~-~-







Tags:
python
python variables
python tutorial
python for beginners
learn python
python 2020
python tutorial for beginners full
python (programming language)
python basics
python course
python language
a/l
code
operators
list
AL
programing
tutorial
logical
dictionary
string
variable
variable assignment
python3.3
ICT