Skip to content

Instantly share code, notes, and snippets.

View kipkitur's full-sized avatar

Kipkemei Kitur kipkitur

View GitHub Profile
#parent class 1
class Item():
def __init__(self, sku):
self.sku = sku
#create a parent class method
#create an example method for this class to show how the child class accesses the attributes and methods from the parent class
def print_sku(self):
print("The sku is {}".format(self.sku))
#while loop runs every time the condition is true
temp = 37
while temp>=32:
print("The water is {} degrees".format(temp))
#use decrement operator to stop loop when the temp is less than 32
temp -= 1
# break ends the loop and goes to the next statement
if temp==32:
break
# import modules
from selenium import webdriver
from selenium.webdriver.common.by import By
import pytest
# we will use Google Chrome in this test. Specify the location of your chromedriver.exe
webdriver_location = "\\Users\\user\\Downloads\\chromedriver_win32\\chromedriver.exe"
# the webpage we want to access for our test
webpage_link = "https://www.example.com/"
class Car:
#use the init method to create objects/attributes that are members of a class
def __init__(self, make, model, year, horsepower):
# to use the __init__ method you have to \
# initialize attributes to be used for all class methods in this class \
# and for objects created by this class \
# use self argument to make sure that the attribute are available to other class methods so that we can reuse our method with every object that we create for that class
self.make = make
self.model = model
self.year = year
name = "yoda"
age = 900
height = 2.2
weight = 50
bmi = weight / round(height ** 2)
print("bmi: ")
print(bmi)
if bmi < 25:
def user_info(name, title, certification, *args, **kwargs):
#this function prints out name,title,certification from an argument provided to the function
print("{} is a {} and an {}. He enjoys {} and {}".format(name, title, certification, *args, **kwargs))
user_info("Kip", "QA tester", "AWS certified solutions architect associate", "finding bugs", "test automation")
def addition():
a=int(input("enter a number. "))
b=int(input("enter a 2nd number. "))
c=int(input("enter a 3rd number. "))
print("{} is a+b, {} is b+c, {} is a+b+c".format(a+b, b+c, a+b+c))
addition()
@kipkitur
kipkitur / bash.sh
Last active November 6, 2018 11:11
Bootstrap script for AWS instance
#!/bin/bash
# A simple script for launching an AWS instance
yum update -y
yum install httpd -y
service httpd start
chkconfig httpd on