Your script must write Cisco commands like
switchport mode access.
In Python, text between quotes is a string.
Figure 1 - Quotes Open and Close a String
You can use double quotes
"or single quotes'but you must use the same quote at the start and at the end.To show a string on the screen, you put it inside
print()like this:print("switchport mode access") # Output: switchport mode accessIn the lab, print the command
no shutdownto get the flag.Answer the question below
Enter the flag you obtained.
To put the value of a variable in a string, you use an f-string.
You put the letterfbefore the first quote and the variable between curly brackets{ }like this:
Figure 2 - The Letter f and the Curly Brackets
port = 1 print(f"interface GigabitEthernet0/{port}") # Output: interface GigabitEthernet0/1In the lab,
vlan_idholds 20.
Use an f-string to print the commandswitchport access vlan 20to get the flag.Answer the question below
Enter the flag you obtained.
To configure a port, you need four commands.
You can store them in one string if it starts and ends with 3 quotes""".You can also put the letter
fbefore the 3 quotes to use your variables in the text.
This kind of string is called a template:
Figure 3 - Python Puts the Values in the Template
In the lab, create a variable named
port_namethat holds "PRINTER" and use it to add the commanddescription PRINTERto the template.Answer the question below
Enter the flag you obtained.