This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import re | |
| from netmiko import ConnectHandler | |
| # Define the device information | |
| device = { | |
| 'device_type': 'cisco_ios', | |
| 'ip': 'your_switch_ip', | |
| 'username': 'your_username', | |
| 'password': 'your_password', | |
| 'secret': 'your_enable_password', | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def cross(A, B): | |
| "Cross product of elements in A and elements in B." | |
| return [a + b for a in A for b in B] | |
| digits = '123456789' | |
| rows = 'ABCDEFGHI' | |
| cols = digits | |
| squares = cross(rows, cols) | |
| unitlist = ([cross(rows, c) for c in cols] + | |
| [cross(r, cols) for r in rows] + | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import re | |
| stringer = """Vlan1 is administratively down, line protocol is down | |
| Hardware is CPU Interface, address is 0009.b7c7.3180 (bia 0009.b7c7.3180) | |
| MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, | |
| reliability 255/255, txload 1/255, rxload 1/255 | |
| Encapsulation ARPA, loopback not set | |
| ARP type: ARPA, ARP Timeout 04:00:00 | |
| Last input never, output never, output hang never | |
| Last clearing of "show interface" counters never | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | """ | |
| You need to write regex that will validate a password to make sure it meets the following criteria: | |
| At least six characters long | |
| contains a lowercase letter | |
| contains an uppercase letter | |
| contains a number | |
| Valid passwords will only be alphanumeric characters. | |
| """ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | """ | |
| In this example you have to validate if a user input string is alphanumeric. The given string is not nil/null/NULL/None, so you don't have to check that. | |
| The string has the following conditions to be alphanumeric: | |
| At least one character ("" is not valid) | |
| Allowed characters are uppercase / lowercase latin letters and digits from 0 to 9 | |
| No whitespaces / underscore | |
| """ | |
| import re | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | """ | |
| ISBN-10 identifiers are ten digits long. The first nine characters are digits 0-9. | |
| The last digit can be 0-9 or X, to indicate a value of 10. | |
| An ISBN-10 number is valid if the sum of the digits multiplied by their position modulo 11 equals zero. | |
| """ | |
| import re | |
| def valid_ISBN10(isbn): |