Script: Cisco Device configuration backup with Python

If you are a network admin or network engineer then you would know the pain of configuration backups.Suddenly one day you will see one of your router died without  any prior issues or errors. And guess what, this is the remote site that you have not logged in since last 6 months. Since this is… Read More Script: Cisco Device configuration backup with Python

HackerRank 30 days of coding – Day 9 ( Recursion)

Task :Write a factorial function that takes a positive integer, N as a parameter and prints the result of N!(N factorial).     Sample Input 3 Sample Output 6 #!/bin/python import math import os import random import re import sys def factorial(n): if n<0: return-1 elif n<2: return1 else: return n*factorial(n-1) if __name__ == ‘__main__’:… Read More HackerRank 30 days of coding – Day 9 ( Recursion)

HackerRank 30 days of coding – Day4 ( Class vs. Instance)

Sample Input 4 -1 10 16 18 Sample Output Age is not valid, setting age to 0. You are young. You are young. You are young. You are a teenager. You are a teenager. You are old. You are old. You are old.   Solution(Python) : class Person:        def __init__(self,initialAge):               if initialAge>=0:              … Read More HackerRank 30 days of coding – Day4 ( Class vs. Instance)

HackerRank 30 days of coding – Day3 ( Intro to Conditional Statements)

Sample Input 0 3 Sample Output 0 Weird Sample Input 1 24 Sample Output 1 Not Weird Solution:  #!/bin/python import math import os import random import re import sys List1=[2,3,4,5] List2=[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] def Weird(): if N%2!=0: print”Weird” elif N%2==0 and N in List1: print”Not Weird” elif N%2==0 and N in List2: print”Weird” elif N%2==0 and 100>=N>20:… Read More HackerRank 30 days of coding – Day3 ( Intro to Conditional Statements)