Posts

Showing posts from December, 2019

DAY 11 - Organize a Secret Santa Game in your organization using a Python Script

DAY 11 - Organize a Secret Santa Game in your organization using a Python Script Secret Santa Rule: ################## The basic concept of the Secret Santa game is simple. All of the participants’ names are placed into a hat, box, etc. and mixed up. Each person then chooses one name from the box, but doesn’t tell anyone which name was picked. He/she is now responsible for buying a gift for the person selected. When the Secret Santa wraps his/her gift, he/she should label it with the recipient’s name but doesn’t indicate whom the present is from. (Remember, most of the fun is in the secrecy.) All the gifts are then placed in a general area for opening at a designated time. When the gift-giving time arrives, each recipient finds his/her gift and must guess who their Secret Santa is. If they can’t guess, their Secret Santa eventually confesses. Gone are the old days when we used to ask each particpant to pick a name from the box. Now it's a digital world. So it is wise to h...

DAY 10 - Python Program to Print the Pascal’s triangle for n number of rows given by the user

DAY 10 - Python Program to Print the Pascal’s triangle for n number of rows given by the user It's the very basic problem statement in python. Following is an 5 level Pascal's triangle: Sample Input: 5 Sample Output: [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] Solution: import pandas as pd import numpy as np n=int(input("Enter number of rows: ")) nested_list = [] for i in range(n):     k = 0     nested_list.append([]) # keep on adding a new list in each iteration of i     for j in range(i+1):         #keep on appending list[i]         if i <=1: # logic for 1st and 2nd list            nested_list[i].append(1)         else: # logic for 3rd list onwards             if j == 0: # fisrt element of list[i]                 nested_list[i].append(1)      ...

DAY 9 - Web Automation Using Python Script

DAY 9 - Web Automation Using Python Script Example 1: Login to Instagram Step 1:  Follow steps mentioned in DAY 1 - Blog to install library - selenium,xlrd,xlwings https://dsbyrr.blogspot.com/2019/10/steps-to-prepare-your-windows-laptop.html Step 2: Download Chrome driver from URL: https://chromedriver.storage.googleapis.com/index.html?path=78.0.3904.105/ Step 3: Create a file say Insta_login.py and save it at Desktop from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.common.action_chains import ActionChains import xlrd import xlwings as xw try:     capabilities = {         'browserName': 'chrome', ...