Variables in Python | Python tutorial :
:-- let's continue with this series on Python in fact in the earlier videos we have talked about what is Python we have installed two software's and we have also worked with certain operations right we had fun in the last session now in this video where I talk about what is variables.
:------ watch video tutorials | Python Tutorials for beginners---------:
#4 Python Tutorial for beginners | variables in Python:
in this Python video tutorial we will see:
- what is variable
- why do we need them
- how to assign value to the variable
- fetching values in the previous operations
- fetching values string variable by index number
- finding the length of string
what is variable?
basically Python variable is a container where you can put your values. an example we are storing to here in a container and the name of that container is X, of course, you can give anything it doesn't matter you can say ABC you can say a box you can give any name.
so we are storing to here in a container and the name of that container is X
and the value is 2.
now we have a variable and value.
how to assign value to the variable:
1st.
x=22nd.
nowresult: 69
x + 67
x='Bot-'
nowresult: Bot-tech
x+ 'tech'
fetching values:
see the examples:
name= 'youtube'
name=[0]name=[1]
result: 'y'
result: 'o'name=[7]
result= 'e'
More examples:
name='youtube'
name=[1:4]
result: 'out'
name=[0:3]
result= 'you'
name=[2:]
result: 'utube'
name=[:2]changing variable:
result: 'yo'
name='youtube'Now I to want to change the variable 'youtube' to 'mytube'.
name='youtube'>>Python tutorial for beginners | basic #3
'my '+name[3:]
result: my tube
No comments:
Post a Comment