This file contains 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
#!/bin/bash | |
if [ "$#" -eq 0 ] | |
then | |
ls | sort | run-parts ${BASH_SOURCE[0]} | |
fi | |
if [ $1 ! 1 ] | |
then |
This file contains 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
from fractions import Fraction | |
# shares price | |
def sharesXprice(stock,valiue): | |
result = stock*valiue | |
divide = valiue % 1 | |
dollar = int(valiue) | |
print("{0} shares with market price {1} {2} have valiue ${3}".format(shares,dollar,divide,result)) |
This file contains 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 get_word_string(user_file): | |
user_file = open(user_file,"r") | |
states = {} | |
#wordString = '' # start with an empty string of words | |
lines = user_file.readlines() | |
header = lines[0].split(",") | |
for line in lines[1:]: | |
items = line.split(",") | |
states[items[0]] = dict(zip(header[1:], items[1:]))) | |
This file contains 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 get_word_string(user_file): | |
user_file = open(user_file,"r") | |
states = [] | |
#wordString = '' # start with an empty string of words | |
lines = user_file.readlines() | |
header = lines[0].split(",") | |
for line in lines[0:]: | |
items = line.split("\n") | |
states.append(items) | |
#print(states) |
This file contains 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 menu_selection(): | |
try: | |
print("Menu:") | |
choice = str(input("add(a), remove(r), find(f):" )).lower | |
except ValueError: | |
print("please follow the directions above") | |
return choice | |
def execute_selection(choice, a_dict): | |
if choice == "a": |
This file contains 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 user_input_dimentions(): | |
not_correct_input = True | |
while not_correct_input == True: | |
try: | |
boardDimentions = int(input("enter width of board: ")) | |
not_correct_input = False | |
except ValueError: | |
print("please stop being an idiot") | |
return boardDimentions |
This file contains 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 make_col(a_list_of_lists): | |
col_list = [] | |
n = len(a_list_of_lists) | |
for n in range(len(a_list_of_lists)): | |
col = [l[n] for l in a_list_of_lists] | |
col_list.append(col) | |
print(col_list) | |
return col_list |
This file contains 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
list_of_list = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] | |
def make_diagonal(list_of_lists): | |
diag = [] | |
diag.append([list_of_lists[len(list_of_lists)-x-1][x] for x in range(len(list_of_lists))]) | |
diag.append([list_of_lists[x][x] for x in range(len(list_of_lists))]) | |
print(diag) |
This file contains 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
RANK = 0 | |
NAME = 1 | |
COUNTRY = 2 | |
POINTS = 3 | |
BIRTH_YEAR = 4 | |
def get_input(user_prompt):## | |
user_input = input(user_prompt) |
This file contains 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
class Clock: | |
def __init__(self,hours = 0,minutes = 0,seconds = 0): | |
self.hours = hours | |
self.minutes = minutes | |
self.seconds = seconds | |
def add_clocks(self,var1,var2,var3): | |
self.seconds = self.seconds + var3 | |
if self.seconds > 59: | |
self.seconds -= 60 |
OlderNewer