
TIME TO MAKE THE FINAL PUSH TO THE SUMMIT OF THE DEVNET ASSOCIATE EXAM!
I will be pounding the pavement with small bite sized chunks of posts up to exam day!
I’ve stalled out a bit in studies getting distracted with wanting to jump ahead to labbing CI/CD and Cloud technologies, so I am going through the DevNet OCG and will be reviewing the notes I find within its contents vs all the other training I have done.
Through taking the $800 Cisco Guided Study Group, having access to INE / CBT Nuggets / DevNet free webinars that are amazing content / Hank Prestons videos / finally the DevNet OCG to finish it off, I have found there are some subtle yet crucial differences in how different sources use certain words which some may not teach exactly the same.
For this reason I am kind of brain dumping all my study sources into single posts to fill in the knowledge gaps, so these will not be conclusive notes on topics, but the quick hitting points that will likely show up on the DEVASC exam based on Cisco practice exams (multiple).
With that lets gets started!
SDLC / Design Patterns / GIT – Quick hitting notes for DEVASC
- Waterfall is the first SDLC that is modeled after how construction of physical infrastructure of cities were in this era, hence why it strictly follows the SDLC cycles
- Lean was an updated SDLC Method taken from post WW2 Japan needing to rebuild with very little, and focused on elimination of waste / Just in time delivery / Continuous Improvement
- Agile was born from the Lean SDLC, with a focus directly on constant software development and deliverable (not necessarily delivered) features, with a customer satisfaction / team building / feature driven SDLC
SDLC 6 Stages = Planning – Defining – Designing – Building – Testing – Deployment
Waterfall and (I believe) Lean aim to deliver products / projects when 100% completed, Lean just trims off extra resources and effort not needed, Agile is feature driven and has a manifesto of principles that guides rapid delivery and flexibility of projects.
MVC / Model View Controller has the huge benefit of being reusable and widely refined by the Developer Community for different applications.
Observer / Subject is a “pushed” or change event driven Design Pattern, where the subject notifies all “subsribed” Observers of changes, the drawback is the resource cost of pushing these notifications to large numbers of Observers / Subscribers.
GIT is only included to say there are no quick highlights for exam day, be sure to knock the rust off on this occasionally by creating branches / conflicts / pushing / pulling / merging from Bash that is Native to Mac and Linux with an SCM available for Windows computers.
GIT Diff = @@ -0,0 +1,8 @@ which the left side indicates a newly created or Untracked File, the left # being file count and the second # being the Y-Axis (Remember Y-Axis!) count of lines in the file, the left set of #’s compares previous known or tracked data if the file to its current data. This example would likely be the output of “git diff –cached” because there is no existing reference in the left # pair.
GIT is a huge topic, need to practice until you git it! 🙂
Python 3
For reference to a pretty large general Python 3 fundamentals I cover a lot of basics here:
Everything below will be DEVASC focused, but I do have general Python posts with tons of screen shots of different examples of what works, doesn’t work, etc!
That being said – On to the DEVASC Python 3 exam day points!
Python 3 is not necessarily compatible with Python 2 scripts, to address the Python Virtual Environments are created as a separate Directory which can have its own versions of Python and Packages installed via pip (PyPI) inside this virtual environment.
“python3 -m venv (dirname)” to create a virtual directory, then “source dirname/bin/activate” in Bash to launch this Virtual Environment, then either install packages individually or install all files you need in bulk using using pip shown here:

I already have a virtual environment called “py3-venv” so I activate it, and another “ls” shows all the files from my home directory but no “requirements.txt” so I “nano” it:

This can be run exactly on the command line, and here this is using the Python Boolean “==” operator that means this == exactly that, whereas you can also do “>=” like you might use for a Python loop (greater than or equal to) telling it to install a version greater than or equal to what you define if a newer version is available.
I actually trimmed down this list a bit to fit my specific needs, and run it shown here:

Its really cool to see the first time this file just fire off non-stop installs of all these programs, you may get errors during this, and I just work through them. Then “pip freeze” after:

This command tells the Virtual Environments to auto-populate with all of these programs and their dependencies when you enter the “venv” environment, to exit this virtual environment gracefully simply type “deactivate” to jump back to the home directory:

Now this virtual environment is ready to be used as its own separate directory branch with all installed programs / modules outside of my main Ubuntu directory installs of Docker / Jenkins / Flask / Etc (from other non-DEVASC projects).
One of the main differences between Python and other programming languages, it white space matters for code to run properly, where other languages use symbols or keywords to describe where code should start / stop!
White space / Indentation being critical, its critical to know how to properly indent!
When it comes to Python Indentation, “4 spaces” is the preferred answer over 1 tab, as 4 spaces is a universal indentation where using a tab may cause white space issues that you will take hours to hunt down – So 4 spaces for each “code block” in Python!
Note that as long as everything is indented completely inline, you could get away with using single space indentation and the code would run fine, but this would be a nightmare to try to spot indented code dependencies at the same indent level so 4 spaces is standard.
#Using the hashtag to add notes to even production code is completely acceptable to explain a block of code for someone else that may be reviewing it.
Some rules to assigning variables to values (a = 0, b = true, c = ‘cat’) :
- Must start with letter and or underscore (_abc = “Hello World!”)
- Variables cannot start with a number
- Variable can only consist of alpha-numeric and underscores, so “bc3_fhe___3f8v” is a valid variable, no hyphens – Only underscores!
- Variables are case sensitive, so cat = 5 and Cat = 10 are two different Variables
- Variables assign a Data Type (boolean, integer, string) to the corresponding variable name, which is stored within a block # of memory within Python (more on this later)
This leads into the topic of being able to Mute / Mutability / Change Variables in Python code.
Data Types / Mutability / Example or Brackets used to indicate the Data Type:

Underscored in red is will be important on exam day as “Mutable” Python Data Sets and will be needed to not just know the three Data Types, but also how to identify their code, which can be spotted by either straight (list) or curly (Dict / Set) brackets.
Added to Integers is a note on Floats, which are treated the same as normal Integers in terms of Mutability, but of course work different with math operations.
Why the focus on Mutable / Immutable Variables? What does it mean?
Python is an object-based in that everything is considered an object, each object is assigned a type / class upon being created (str, int, bool) and a storage block ID from which it is called by the script for use, and Mutability / Immutability refers to whether a set of objects can be interchanged with other objects (Mutable) or whether it is intended to be a “constant” or what is considered “Immutable” – Being able to answer which Data Types are Mutable / Immutable and how they might impact a script is important for exam day and just the concept of how you are writing a script.
Some data sets you will want to be interchangeable with different objects / variables, where as some data sets you will want to stay the same and not be changeable with manually re-assigning the Variables / Objects.
I will not cover math operators as I’ve exhausted that subject in other recent Python Posts with screen snips to demo, however there is some interesting concepts I had not really experimented with up to this point, that Python can return 3 different # value types:
- 0b / 0B = Binary
- 0x / 0X = Hexadecimal
- 0o / 0O = Octal

I have not built my own script defining addresses or number in this way, but thought it was good to demonstrate the 3 different return codes for those value types and that dotted decimal will not work with it – However what does 192.168.10.1 in Binary return? Lets see :

So I’m not entirely sure how that factors in, but 0b = Binary / 0x = Hex / 0o = Octal, and that is about all I will go into that for exam day purposes unless I find a use case for it in labbing.
One important concept is to immediately define these Boolean math operators on the spot:
- > Greater than – 4 > 5 = False
- < Less Than – 4 < 5 = True
- >= Greater than or equal to – 4 >= 5 = False
- <= Less than or equal to – 4 <= 5 = True
- == Equal to – 4 == 5 = False
- != Not Equal to – 4 != 5 = True
This was shown in the Python ‘venv’ requirements.txt that programs can be installed with a preference of equal to or less than / greater than a certain version #, so this can be both an absolute boolean true / false or in it can serve other purposes including Python Loops to iterate through a series of numbers or comparing values and taking action based on value.
Another critical point to have down cold, is knowing that List / String objects start at the 0 index when running a function against them, as shown in this brief screen snip:

A thorough demo of string splicing / playing with lists can be found (lots of pics) in the link at the top of the this Python 3 section, I’d check it out if your not familiar with this!
Since I have this up a few more examples of this for the sake of clarity can be seen here:

0 1 2 3 4 5 6 7
E x a m p l e
Whether it is characters in a String or different Objects in a List, this will work the same when working with Lists, where the left side is where it starts, and then move forward until it hits the defined last # of the list at which point it halts the function!
Looking at this you can see block #5 “p” is where a lot of things stop or begin, and this shows the left side will start where it is told, and the right side is where the list will be stopped, that is why [:-3] stops at “Exam” because where it stops is not run by the function.
If that is not clear through this quick example, I’d really go check out my Python post and just ctrl + f and search the page for “splicing” and I demo all sorts of splicing and this memory # concept when working with Lists.
Then there is the last output that shows nothing, and this is because when going backwards in running a List against a function, if you begin with a negative value, it will start however many -# back is in the right and will continue going backwards if the right hand # is -# :

Note that this is still listing all objects or characters of the string Forwards, to actually run through a list backwards refer to my article linked for a full explanation, but a quick screen grab example from that post demonstrates it visually here (though I’d know why this works):

I will end that here, but listing and indexing of objects is a must know for Python 3!
Next is demonstrating Python “Methods” that are used to manipulate mutable objects!
Next I will hit String Manipulation using the “str.somethin” commands and what they do:

These are all Native to the Python Standard String library, I would know what these do for exam day, though I don’t expect raw python code to be a major focus at all as all the practice exams I’ve taken provided by Cisco is very balanced in the blueprint items and if you see Python it will generally be in reference to unit testing / code testing / API functions / etc.
Note below that your actual string name will replace the “str.” in the above Methods list:

This is some examples of the more basic ones, I will play with these more extensively in my own time, though again I would focus more on DEVASC topics that utilize Python and what need and practice Python within that context with the aid of Visual Studio Code.
I am using Linux Bash IDE to demo here, but I would use Visual Studio Code or Atom to practice for exam day as they have plugins / add-ons to assist coding, and VSC I know even has a built in REST API Client Plugin available so you can test code immediately!
List Methods in Python:

Below I create a “List” of names / Strings to manipulate with the above Methods:

Above shows just playing with the initially created list, then below I switch I navigate through the list by index values to show a small demo on how to navigate that:

There are many different ways to list objects within well, a List, and I wanted to keep that error in there to show that adding a blank [ ] will just throw an error – There has to be something in there that tells the list where to start and where to stop!
Below is a quick demo of lists being “mutable” as I change an object in it by index #:

Here for just a small pinch of less boring lab output I renamed the Index 1 (Mike) with ‘Dave’ in the List, this is what makes Lists “Mutable” in Python, is that they can be changed!
Again I would kind of get the basics of these “Methods” and what they do in mind, but focus on the Python that is needed for DEVASC topics (API’s / Code Testing / Etc) for exam day.
Python Tuples Time!
Though Tuples are basically a List with Parenthesis, they are NOT mutable!
Tuples are similar to a List, however they can be identified by their use of Parenthesis:

Lists can also mix Data Types like Integers and Strings, however they are Mutable or Changeable, whereas the Tuple identified by the Parenthesis is Immutable.
**I’ve found a good way to identify Immutable Data is by Curly / Square Brackets.**
Its very easy points on exam day if you are simply asked which types are mutable, just remember if you see brackets you see Mutable Data, anything else is not Mutable!
The purpose of Tuples is to ensure that changes to a script are not allowed to make changes to a possibly critical part of the script to function, which in turn makes it easier to bug, and also reduces less memory space as it will not be re-assigned new values.
That being said, you can display / extract data from Tuples, but there are no methods for them because they cannot be changed / adjusted / muted at all!
However an interesting part of Tuples is they can be used to assigned multiple Variables to Multiple Values / Data Types in one single line, but the Variables are Mutable here:

This was kind of a head scratcher for me as I never used a Tuple in this way that makes the Variable Mutable or Changeable as seen with A / Alpha / Santa, so when assigning a single Variable to a Tuple it is Immutable but multiple Variables assigned values via Tuple allow those different Variables to be changed / Mutable – I will update if I find this to not be correct.
Python Dictionary Data Sets!
This introduces a bit of complexity or granularity to assigning values to a Variable, as this is the Data Type that assigns key:value pairs to describe an item, for example:

One rule of Dictionaries is that the Key in the Key:Value pair must be an Immutable object, so you cannot use a List as an item, however you can use a Tuple and insert it as shown:

Again the Key must result in a value that can be anything, so long it is an Immutable class like Integer, Float, Boolean, String, etc – But they cannot be Mutable or changeable values!

I was for some reason thinking () was needed for Integers so I ran a quick test, and verified it will work to assign straight Int’s and Floats to Dictionaries, however if you are adding multiple values for #’s is when you will need the () to enclose the multiple values^^^
Yes, I am still very much in my infancy when it comes to freestyle coding Python 🙂
Python “Sets” Data Types!
Sets are an unordered grouping of data enclosed by Curly braces which is considered Mutable in general sense, though there are ways to make Immutable Sets by created what are called “Frozen Sets” in Python, but first lets look at Sets start with Integers 1-10:

Here it is seen that Python detects this Data Type is a “Set” because it is using the Curly Brackets without key pair values, shown here is using the pipe “|” to combine the two sets but not show any duplicate info between them, and using the “&” shows which values the two sets share in common with each other shown in the output.
Oddly this seems to be about it that is needed to know for DEVASC on “Sets” Data Type in Python, so its not Mutable generally, but can be with “Frozen Sets” in Python.
Gathering user input in a Python Script using “input” function as shown here in an earlier “Tax Owed” program I wrote with very basic Input / Math to produce a result:

When this script runs and hits “TotalPay = input()” on line 5, the program expects an Integer Value to then run against a generic 1/3 of your pay in taxes is owed to the Uncle Sam. This program however has no “Error Handling” which would be built into an “if / else / elif” loop that would prevent me from typing the String “Ten Dollars” and throwing this program into an error and me not filing my taxes due to a poorly designed program!
This can also be done right from the IDE line, however only to set a variable via input:

On the IDE I can simply ask for input in String format noted by the absence of any defined class ahead of it, then I do define a class of my age in Human Years (I am not quite that old) to show that the “input()” function is simply a means of assigning a value to a predefined class in the code that is set based off user input.
A quick refresher of some of the flow control mechanisms that can be used in a string:
- \\ – Backslash
- \b – Backspace
- \’ – Single quote
- \” – Double Quote
- \t – Tab
- \r – Carriage Return
- \n – Breaks to next line
This quick list is a disservice to the full demo I have in my Python Link towards the top of this section, I go into those deep with pictures in that, I would really advise to check it out!
A quick review of the “sep=”” function with using the print function, used with my “Set” already configured, to demonstrate what exactly sep=” does in a line of printed code:

There it is, look at that beautiful formatting!
sep=” removes any extra spaces that the print function adds by default, however as seen it can squish thing together in an even worse looking way, but by manually adding a couple spaces highlighted in the third line the print output now looks clean and good to go.
So sep=” removes the default lines the print function adds by default is the point there^^
And now for a quick look at f-string typing, which is a strongly typed format of strings:

I hit this snag and wanted to leave it up to demonstrate the syntax of print(f'{…} ‘), so the f goes inside the print open parenthesis, and then quotes directly after the f and before the close parenthesis to complete the print function to get the correct output as shown here.
To anyone who doesn’t get the reference, googling fubar / Tango and Cash is NSFW (so don’t do this on your work computer if you don’t get the reference!) 🙂
Lastly a look at Flow Control with “if” Statements and two kinds of Loops!
Loops are used for flow control of not just “input” programs in case the syntax input is maybe not recognized or expected, but determine how any script will run, whether its against a network devices config to update settings or print “Hello World!” 100 times.
There are 3 main Control Flow mechanisms, 1 of them a statement and 2 are loops:
- if = “if” statements compare values to make branching decisions if/elif/else
- for = “for” loops perform counting or “iterating” through data a specified # of times
- while = “while” loops iterate while someone is true, this type of loop can become infinite
I would make sure to know “for” and “while” are the 2 Conditional Loops for exam day!
Working with if / elif / else Statements
I wrote kind of a Juvenile, funny example similar to one I wrote awhile go for if/elif/else:

Then I hit the debugger and hit lines 5 / 7 / 9 / 11 in each example as shown below here:

As shown here the “if” statement kicks off the branching, and can lead to a Yes / No branching where it goes directly from if to else, however in here I have embedded:
- if age >= 21: Greater than or equal to 21 than come on in and have a drink
- elif age >= 100: Greater than or equal to 100, however this statement never runs, because the first “if” line covers ANY age over 21 so it kicks out the same line
- elif age >= 18: this will cover input of 18-20, as seen the first line will take over if it is greater than or equal to 21, and if nothing else it proceeds onto the last line (else)
- else: – This is the line of last resort, if no criteria in the if / elif statements matches the input, it gives a final message shown here as being under 18 / scram 🙂
There can be “nested” if statements within just a single indentation, it does have to be 4 white spaces to indent, keeping if statements inline and elif / else statements in line along with indenting the corresponding function like my print() statements every boolean branch.
Which brings us back to the Boolean operators that “if” statements use:
- > Greater than – 4 > 5 = False
- < Less Than – 4 < 5 = True
- >= Greater than or equal to – 4 >= 5 = False
- <= Less than or equal to – 4 <= 5 = True
- == Equal to – 4 == 5 = False
- != Not Equal to – 4 != 5 = True
I have to imagine for exam day and of course beyond that its important to know clearly that “if” statements search for the “truth” of boolean operations that branch off until it hits a match (or the final else: line), it does not “iterate” and is not considered itself a “Loop” !
^^^That is on many Cisco Practice exams, I expect it to be on DEVASC 100%.
Speaking of Loops – A look at “for” Loops!
Where “if” statements search for Truth via Boolean return values, “for” Loops is a “counting” loop where it is meant to iterate through code or sequence of items a set number of times, like a number range() or a data type like a list or set.
This is a very simple demonstration of a “for” loops at its very most basic:

Note that it does iterate 3 times only because the loop stops iterating once it hits the final number rather than iterating that last time, and that both “if” statements and “loops” all require a “:” at the end of the statement / loop line or it will error out.
^^^ That colon to define it is a loop / if statement is very forgettable to me for some reason.
Using a “for” loop in a different way as mentioned say with a list printing the items in it:

One final example is to demo using a 3rd range value to tell the loop the count to go by:

I like this example because it demonstrates another (of very very many) critical concepts of coding with range / for loops, you might look at that at first and think it will print 4 lines with a range of 1-13, but it only prints 3 times at 1, 5, and 9 numbers in that range of numbers.
Some basic but critical Python concepts to make it through DEVASC on “for loops!
Finally to finish this off – “While” Loops!
While the “for” loop is meant to iterate through data (pun intended), “while” Loops are considered to be a “Conditional Loop” in Python, because it relies on an external Variable in the script to determine how many times it will Loop / Iterate – This Loop also uses both “else:” and “break” statements to exit the Loop – However it can form an infinite loop:

I actually ran the debugger after typing about the loop exits and caused an infinite loop, so I figured I’d grab a screen snip and restart Visual Studio Code to show a proper loop example:

Will it print an iteration for 5 before ending with the “<=” making it less than or equal to? :

So those operators are important to know exactly how they function, as it will not hit “less than” before it hits “or equal to” in the operator, because it is “less than or equal to” which just I think demonstrates its important to at least be solid on these operators and the output.

I snuck a “\n” in there to make my “break” line, this is an intentionally infinite loop if there is no break in it, as “while True:” will always be true and continue printing the input until the end of time unless the exit (not ‘exit’) is typed to break the loop and print “Bye See ya!”
Speaking of Bye See ya, this concludes Part 1 of 2 of Python for the DEVASC!
I will dedicate the entire next post to Python 3 as that is really my kryptonite in studying, I was going to try to just brush over the topic again before exam day, but the more I work with it the more I realize I need to work with it more as its really forgettable if you don’t keep at it.
On that note, I am done here, ‘exit’ til next time! 🙂