Skip to main content

Featured

What is Coroutine in Android?

Coroutines are available for the Kotlin language. Coroutines are simply cooperative functions.   Our Android applications often have multiple concurrent and interdependent functionalities. We provide instructions to the system through code, also known as a program, to perform a set of sequential instructions.  During the execution of these instructions, a specific instruction may take longer than expected, causing the next line of code to wait until the previous line of code has completed its execution. This scenario is known as blocking program execution. To avoid blocking program execution, the code must be executed on a separate thread. A thread is a single sequential flow of control. However, creating and handling multiple threads can be difficult and expensive in terms of OS operations and memory usage. To address this issue, we can use Coroutines in Kotlin. Coroutines are cooperative functions that are executed on threads as needed in a cooperative manner. They help...

Python Variables

Hello All,

In this post is about what are variables in python ? , How you can declare variables in python?

I hope you have already installed python on your machine. If you haven't yet please read this post : Hello World in Python


How to Declare Variables in Python ?

It is so easy to declare variables in python. Just you have to select name of variable and assign the desired value to it , like as follows :
In Python we don't have to explicitly define the datatype of variables python automatically determines what value is assigned to the variable.
Same variable can store different types of vales as well. For example :


If you are familiar with other programming language then you will notice that you can use the same variable for storing different types of values , this is because Python is Dynamically-typed language unlike other languages like C,C# or Java and many more which are Statically typed Language.


Naming Conventions for variables
You can define variable by using alphabets , numbers and special characters. But there are some rules to declare variables :


1.Variable Name should start with alphabet(lowercase or uppercase) or an underscore(_) but , it shouldn’t start with digit.


Valid Variables :
_myVar , myVar , MyVar , MyVar1 , my_var , etc...
Invalid Variables :
1myVar,104Variable,m*var,my-var

2.Variables in Python are Case-Sensitive. So that means myVar,MyVar and myvar all 3 are treated as different variables.

If you like this Post please share with your friends. Thank you.

Comments

Popular Posts