DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)
A floating point number is just a whole number with a decimal point. When you divide in Python, you often get a remainder that i ...
>>> 0xbadbeef 195935983 You can also convert back and forth by using the base keyword in front of the value you want to ...
!= Not equal to 5 != “5” True Strings The string data type is a sequence of characters and uses quotes to determine which charac ...
always start with 0, so if you want the very first character in a string, your index value would be 0 and not 1. Figure 3-3 show ...
to stop at box 3 (but don’t want to open the box). If you want to print the whole string, just pick a number beyond the index va ...
in this example: >>> 'DevNet' + 'Rocks' 'DevNetRocks' Multiplication works as well, as in this example: Click here to v ...
str.replace(old, new[, count]) Replace characters in the string str.lower() Make the string all lowercase str.rstrip([chars ]) S ...
Lists are similar to strings in that each is a set of items indexed by Python that you can interact with and slice and dice. To ...
unique. Python just connects the two together into a new list, as shown in the following example: >>> a = [1, 2, 4] > ...
list.copy( alist) Returns a copy of the list list.coun t(elemen t) Shows the number of elements with the specified value list.ex ...
because you don’t have to create a new object every time you need to store different values. When you have a value that is const ...
Tuples can, however, be used to assign a set of variables quickly: Click here to view code image >>> (a, b, c) = (12, ' ...
>>> type(cabinet) <class 'dict'> Instead of using an index, you use the key, as shown in this example: >>&g ...
>>> numbs = {1, 2, 4, 5, 6, 8, 10} >>> odds = {1, 3, 5, 7, 9} To check that these are indeed sets, use the typ ...
Input and output pretty much define what a computer does for you. In Python, the input() function and the print() function are t ...
Here you asked the user for the temperature in Fahrenheit, which can be expressed as a floating point number. To make sure the v ...
\r: Carriage return You can add multiple arguments to the print() function by using commas between elements. This is very useful ...
are doing, and then you can use {} within your string to insert values or other functions. Here is an example: Click here to vie ...
whitespace indenting matters very much in Python. The clause of an if statement must be indented (four spaces is the standard) f ...
An if statement can have as many elif conditions as you want to add to the conditional check. Good coding practices recommend si ...
«
5
6
7
8
9
10
11
12
13
14
»
Free download pdf