0 ratings0% found this document useful (0 votes) 78 views7 pagesPython Lab Review
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
ciate a
= yh DevNet As
‘#1 / Course Inrodueton / Python
11 The Power of Code
The Power of Code5 Network Fundamentals
1. Course introduction
181 The Power of Code
2. Lab Python Programming Review
Quiz - Python Review
ow did you do on the Python
Programming Review Lab?
Net Developer
2
43, Software Development and
ion
4. Understanding and Using
Python Programming ®
Python is an easy to learn programming language that you will use throughout ths course.
\Why should you leam Python? You will need to become familar with basie Python to complete
many ofthe labs inthis course. In addition to ths, the Python Essentials course (see the link in
‘Student Resources) names a few factors that make Pytnon a great tool for learning basic
‘coding
«ts easy to leam - the time needed to lea Python is shorter than for many other
languages; this means that it's possible to start the actual programming faster.
«Its easy to use for wrting new software -it's often possible to wirte code faster when
using Python
+ Its easy to obtain, install and deploy ~ Python is ree, open and multiplatform; not all
languages can boast that.
+ fyou'te not fariar with any other languages, Python Is great to begin with, because it will
give you a solid foundation and allow you to lear other programming languages (2.9., Ove,
Java, oF C) much easier and much faster. Leaming Python is fun and tendy!
Lab - Python Programming Review ®
‘This Python Programming Review lab is designed to establish your level of Python expertise
bfore you continue with the DevNet Associate course,
In this lb, you will complete the folowing objectives:
+ Part 1: Launch the DEVASG VM
+ Part 2: Start Python and VS Codeaaa
14
Network Fundamentals v
Show Menu
‘Course introduction ~
vytnon “
‘The Power of Code
Python Programming
Lab ~ Python Programming Review
Quiz = Py
5m Review
How did you do on the Python
Programming Review Lab?
Course introdvetion
‘Summary
‘The DevNet Developer
Environment
‘Software Development and
Design
Understanding and Using
APIs
+ Part 3: Review Data Types and Variables
+ Part 4: Review Lists and Dictionaries
+ Part §: Review the Input Function
+ Part 6: Review If, For, and While Functions
+ Part 7: Review Methods for File Access
a Python Programming Review
Quiz - Python Reviewaaa
Network Fundamentals
Course Introduction
‘The Power of Code
Python Programming Review
Quiz - Python Review
ow did you do on the Python
Programming Review Lab?
Software Development and
Design
Understanding and
1A student is learning Python using the interactive interpreter mode. The student issues
the commands:
>>> routers=[]
>>> switches=(]
de> devices=[\"RTI\", \'RT2\", \WRT3\", SHY", \'SW2\", \"SH\
D>» devicesedevices + [\*RTA\", \'SwA\"]
de> for £ in devices
routers append(s)
else: switches. append( 4)
What isthe result?
© Topic 1.3.0 - In Python, two lists can be concatenated by using the +
(plus sign) operator. The second lst appends to the frst list and makes a
new list. The Python for function is used to loop through the elements in a
list and perform an operation on an element. The if statement can be used
within the for function to determine the proper action based on the
matching condition of each element.
Orswel
swe, swe, ‘sw’ ‘sive
) rswver, sw, ‘sw’ ‘sw
‘swat, “SW1",‘SW2','SW3']
‘SW1",‘SW2,,‘SW3']aaa
Course Introd
‘The Power of Code
R
Programming Review Lab?
and Usin
2..A student is leaming Python in the interactive interpreter mode. The student issues the
‘commands:
>>> devicenamese[\°RTA\", \°RTZ\", \"SWI\", \*SH2\"]
>>> devicenaces{-1]
What isthe result?
(© Topic 1.3.0 - In Python, an item in a list can be referenced and
manipulated using its index. The fist item ina ist is indexed as zero, the
second is indexed as one, and so on, The last item can also be referenced
with an index of [1].
Swi
a2’, ‘SW1', ‘SW2']
Orn
swe
O an error message
2. A developer needs to check the version of the running Python package. Which
‘command shouls the developer use?
© Topic 1.3.0 - The command python3 starts Python, but adding the =
V option displays the specific version being used.
Opvtnons 4
Oprthons
Oprthons -«
python -Vaaa
Network Fundamentals
Course Introduction
‘The Power of Code
Python Programming Review
Quiz - Python Review
ow did you do on the Python
Programming Review Lab?
Software Development and
Design
Understanding and
4. student is leaming Python in the interactive interpreter mode. The student issues the
‘command:
>>> type(True)
\What is the data type reported by Python?”
© Topic 1.3.0 A type of True or False is a predefined value of the
Boolean data type.
CO toat
O sting
Boolean
) Imeger
'5. Which Python programming function Is used to display output?
(© Topic 1.3.0 - Print is used to display output in a Python programing
language interpreter.
print
Ownite
or
>) for
Check
‘Show Me
Resetaaa
14
Network Fundamentals v
Show Menu
‘Course introduction ~
vytnon “
‘The Power of Code
Python Programming
Lab ~ Python Programming Review
(Quiz - Python Review
How did you do on the Python
Programming Review Lab?
Course introdvetion
‘Summary
‘The DevNet Developer
Environment
‘Software Development and
Design
Understanding and Using
APIs
How did you do on the Python Programming Review (®)
Lab?
How did you do on your Python Programming Review Lab? If you had trouble with this lab, we
recommend you spend some time taking the Pyshon Essentials course liste in the Student
Resources page. You'll ind a ink tothe course in the More Courses table near the bottom of
that page. I's free, online, and self-paced,
Unax ‘Course introduction Summary