Python Programming and Variable

Python Programming and Variable

    Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990.
    It is used in web development, data science and so on. Fortunately for beginners, Python has simple easy-to-use syntax.
    This makes Python an excellent language to learn to program for beginners.
Facts of Programming and Variable
    So, what do you need to do with this in order to work with Python?
    So, let's see. We are talking about variables now, so it just might be different now.
    Always remember, whenever we show the Python file, the extension for the Python file is done by ( .py )
    OK, now let's just do a basic programming like print.
    Print (Hello World).
    And just click on the run button and then you'll get down output.
This is your Python PyCharm Idle

Python Variables​

    Variables in Python are nothing but reserved memory locations to store data values. For Creating Variables in Python has no command for declaring a variable. A variable is created the moment when you first assign a value to it.
    In Python, a variable may be assigned a value of one type and then later re-assigned a value of a different type:
Now talk about variables, what are variables ?
    We know that variables is something which is used to Store the data.So whenever we create a variable that basically we create a memory space in our file. this much memory will be allocated now in order to define a variable, we require datatypes like Int ,Double,string, but there's an advantage of Python that we do not need to mention datatypes while writing the variables.
					int a = 20
float b = 11.30
string s = "Python"

    But over here in Python, you do not need to mention any details as soon as you declare a variable,
    let's see example that we are creating a number in, which is 15 it will be directly assigning the datatypes to the particular variable.You did not need to mention datatype while writing python variables.
					num = 15
    Now, Let's some examples -
					#Creating Variables
>>> num = 15
>>> decimal =14.32
>>> name = "Python"

>>> print("Number is",num)
Number is 15
>>> print("decimal is",decimal)
decimal is 14.32
>>> print("we are learning",name)
we are learning Python

#Variable casting - use to specify the data type of a variable
>>> x = str(5)    # x will be '5'
>>> y = int(5)    # y will be 5
>>> z = float(5)  # z will be 5.0

#Variable with the type() function.
>>> x = 5
>>> y = "Sheetal"
>>> print(type(x))  #x will be<class 'int'>
>>> print(type(y))  #y will be<class 'str'>

#String variables with single or double quotes:
>>> x = "John"
#double quotes are the same as single quotes:
>>> x = 'John'

#Variable case-sensitive.
>>> a = 4           # a will be 4
>>> A = "Codetech"  #A will be Codetech
#A will not overwrite a

    So, whatever we are deciding, whatever we are writing. variables can be input directly.
    The basic concepts of the variable is that you do not need to mention any data,
    So, that you can directly declare the variable or write the variable indirectly and write the data also.
    That's the most advantage of using Python compared with any other programming language Like - C, C++ or even in JavaScript.
    So that's the most advantage of using python variables.

Python Programming

    A programming language is a formal language comprising a set of strings that produce various kinds of machine code output. Programming languages are used in computer programming to implement algorithms. Most programming languages consist of instructions for computers. There are programmable machines that use a set of specific instructions, rather than general programming languages.
Thank You For Visiting Our Website!
Please Visit : Introduction to Python – Code-Tech Community
And make sure to leave us a comment down below , we will be happy to know if this worked for you.

Happy Coding Mates ! 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Shopping Cart