Python for Network Engineers (Part-1)- Variable Declaration
Variable Declaration
Rules for Variable Names:
======================
1. A variable can have a short name (like x and y) or a more descriptive name (cisco, server_names). Rules for Python variables:
2. A variable name must start with a letter or the underscore character. A variable name cannot start with a number
4. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
5. Variable names are case-sensitive (cisco, Cisco and CIsco are three different variables)
PS C:\Users\Trainer_PC> python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> Cisco = "CCNA"
>>> Cisco
'CCNA'
>>> Cisco = "CCNA->CCNP>CCIE"
>>> Cisco
'CCNA->CCNP>CCIE'
>>> Juniper = "JNCIA-JUNOS,JNCIS-SEC,JNCIP-SEC,JNCIE-SEC"
>>> juniper
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'juniper' is not defined
>>> Juniper
'JNCIA-JUNOS,JNCIS-SEC,JNCIP-SEC,JNCIE-SEC'
>>> cisco, juniper = "CCNA","JNCIA"
>>> cisco
'CCNA'
>>> juniper
'JNCIA'
>>>
>>> cisco=juniper=mikrotik="Routing & Switching"
>>> cisco
'Routing & Switching'
>>> Juniper
'JNCIA-JUNOS,JNCIS-SEC,JNCIP-SEC,JNCIE-SEC'
>>> juniper
'Routing & Switching'
>>> mikrotik
'Routing & Switching'
>>>
>>> print (Pyhton for Network Engineers)
File "<stdin>", line 1
print (Pyhton for Network Engineers)
^
SyntaxError: invalid syntax
>>> print ("Pyhton for Network Engineers")
Pyhton for Network Engineers
>>>
>>> print ('Pyhton for Network Engineers')
Pyhton for Network Engineers
>>>
>>> print ('juniper')
juniper
>>> print (juniper)
Routing & Switching
>>>
Red Prism Group ins one of the best Django coaching in Noida. Learn Django from industry expert with practical training, live projects and got your certificate.
ReplyDelete