#4 Python Tutorial for Beginners | Variables in Python



Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist : https://www.youtube.com/watch?v=hEgO047GxaQ&t=0s&index=2&list=PLsyeobzWxl7poL9JTVyndKe62ieoN-MZ3
Python Tutorial in Hindi : https://www.youtube.com/watch?v=JNbup20svwU&list=PLk_Jw3TebqxD7JYo0vnnFvVCEv5hON_ew

In this video we will see :
– What is variable
– Why do we need them
– How to assign value to variable
– Fetching value of previous operation
– String value to variable
– Fetching value of string variable by index number
– Finding length of string

Github :- https://github.com/navinreddy20/Python-

Editing Monitors :
https://amzn.to/2RfKWgL
https://amzn.to/2Q665JW
https://amzn.to/2OUP21a.

Editing Laptop :
ASUS ROG Strix – (new version) https://amzn.to/2RhumwO

Camera : https://amzn.to/2OR56AV
lens : https://amzn.to/2JihtQo

Mics
https://amzn.to/2RlIe9F
https://amzn.to/2yDkx5F

Check out our website: http://www.telusko.com

Subscribe to our other channel:
Navin Reddy : https://www.youtube.com/channel/UCxmkk8bMSOF-UBF43z-pdGQ?sub_confirmation=1
Telusko Hindi :
https://www.youtube.com/channel/UCitzw4ROeTVGRRLnCPws-cw?sub_confirmation=1

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
http://www.telusko.com/contactus

Instagram: https://www.instagram.com/navinreddyofficial

Facebook: https://www.facebook.com/navin.reddy20

Twitter : https://twitter.com/navinreddy20

More Learning :

Java :- https://bit.ly/3x6rr0N
Python :- https://bit.ly/3GRc7JX
Django :- https://bit.ly/3MmoJK6

JavaScript :- https://bit.ly/3tiAlHo
Node JS :- https://bit.ly/3GT4liq

Rest Api :-https://bit.ly/3MjhZwt
Servlet :- https://bit.ly/3Q7eA7k
Spring Framework :- https://bit.ly/3xi7buh
Design Patterns in Java :- https://bit.ly/3MocXiq
Docker :- https://bit.ly/3xjWzLA

Blockchain Tutorial :- https://bit.ly/3NSbOkc
The Web3 Show:- https://bit.ly/3MmqzL0
Corda Tutorial:- https://bit.ly/3thbUKa
Hyperledger Fabric :- https://bit.ly/38RZCRB

NoSQL Tutorial :- https://bit.ly/3aJpRuc
Mysql Tutorial :- https://bit.ly/3thpr4L

Data Structures using Java :- https://bit.ly/3MuJa7S
Git Tutorial :- https://bit.ly/3NXyCPu

source

Avatar of Telusko

By Telusko

24 thoughts on “#4 Python Tutorial for Beginners | Variables in Python”
  1. sir, this course is like finding a coca cola in the middle of the desert. i was taking a course at my uni about this language but it was so complicated and then i find this playlist, thank you very much for sharing this

  2. How can len function is giving 11 output your name is of 10 string character

  3. sir while using len fxn ,its taking space as a character and count it to. i want space between character and dont want it to be counted. what is the way of doing that sir

  4. Really looks simple when you explain things. Since coming from a non-coding background, this teaching technique method is really easy to understand.

    >>> print ('Thanks Navin')
    🙂

  5. used the underscore and a number i got the error below.
    print (_+ 2)

    TypeError Traceback (most recent call last)

    Input In [18], in <cell line: 1>()

    —-> 1 print (_+ 2)

    TypeError: can only concatenate str (not "int") to str

  6. Can we have a notes of all the topics explained in this video?
    Anyways you made it easy and fun to understand this topic
    Looking forward to learn Python from you
    Thanks

  7. Variables

    Variables are containers for storing data values.

    Creating Variables

    Python has no command for declaring a variable.

    A variable is created the moment you first assign a value to it.

    Variables do not need to be declared with any particular type, and can even change type after they have been set.

    x = 5

    y = "John"

    print(x)

    print(y)

    Output : 5 john

    Casting

    If you want to specify the data type of a variable, this can be done with casting.

    x=str(3)

    y=int(3)

    z=float(3)



    print(x)

    print(y)

    print(z)



    Output:

    3

    3

    3.0

    Get the Type

    You can get the data type of a variable with the type() function.

    x = 5

    y = "John"

    print(type(x))

    print(type(y))

    Output :

    <class 'int'>

    <class 'str'>

    Single or Double Quotes?

    String variables can be declared either by using single or double quotes:

    x = "John"

    print(x)

    #double quotes are the same as single quotes:

    x = 'John'

    print(x)

    Case-Sensitive

    Variable names are case-sensitive.

    a = 4

    A = "Sally"

    #A will not overwrite

    Python – Variable Names

    Variable Names

    A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for Python variables:

    • A variable name must start with a letter or the underscore character

    • A variable name cannot start with a number

    • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )

    • Variable names are case-sensitive (age, Age and AGE are three different variables)

    Legal variable names:

    myvar = "John"

    my_var = "John"

    _my_var = "John"

    myVar = "John"

    MYVAR = "John"

    myvar2 = "John"

    Illegal variable names:
    2myvar = "John"

    my-var = "John"

    my var = "John"

    Remember that variable names are case-sensitive

    Multi Words Variable Names

    Variable names with more than one word can be difficult to read.

    There are several techniques you can use to make them more readable:

    Camel Case

    Each word, except the first, starts with a capital letter:

    myVariableName = "John"

    Pascal Case

    Each word starts with a capital letter:

    MyVariableName = "John"

    Snake Case

    Each word is separated by an underscore character:

    my_variable_name = "John"

Leave a Reply

Your email address will not be published.

Captcha loading...