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 shutil | |
| import csv | |
| import sys | |
| import os | |
| from PIL import Image | |
| def acquire_user_data_csv(file_path): | |
| ''' | |
| function that opens a csv file and returns the content | |
| return type: list |
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
| ''' | |
| 2022-04-07 | |
| Python script that converts a sentence to | |
| sarcasm stupid Spongebob style | |
| example: | |
| Hello There | |
| hElLo ThErE | |
| ''' |
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 random | |
| class Die(): | |
| def __init__(self, faces): | |
| self._faces = faces | |
| def get_faces(self): | |
| return self._faces | |
| def roll_die(self): |
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
| from die import Die | |
| def generate_dice(amount, faces): | |
| dice_list = [Die(faces) for die in range(amount)] | |
| return dice_list | |
| def roll(dice): | |
| values = [die.roll_die() for die in dice] | |
| for die in values: | |
| print(die, end=' ') |
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
| ''' | |
| PHOTOS: | |
| Photo by Josh Sorenson from Pexels | |
| Photo by Darrel Und from Pexels | |
| Photo by cottonbro from Pexels | |
| ''' | |
| import pathlib | |
| import sys,os,shutil | |
| from PIL import Image |
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
| ''' | |
| python script that generates a password based on user input. | |
| supports words,numbers, and special characters. | |
| Author: Martin Aaberge | |
| Date: 2021 10 19 | |
| ''' | |
| import random |
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
| from random import randint | |
| def user_interface(options): | |
| ''' | |
| function presenting options and asking for player feedback | |
| returns integer. | |
| ''' | |
| for index,option in enumerate(options): | |
| print(f'{index} = {option}') |
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
| from random import randint | |
| def computer_number(min_num,max_num): | |
| ''' | |
| function that generates a random number based on the range passed as args. | |
| returns random int | |
| ''' | |
| return randint(min_num,max_num) | |
| def player_guess(min_num,max_num): |
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
| from random import randint | |
| def roll_die(eyes,amount): | |
| ''' | |
| function that rolls die based on die data. | |
| returns die_roll list | |
| ''' | |
| die_roll = [randint(1,eyes) for die in range(0,amount)] | |
| return die_roll |
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 binary_performance(): | |
| run_setup = ''' | |
| from __main__ import binary_search | |
| ''' | |
| run_code = ''' | |
| bin_list = list(range(6,501)) | |
| binary_search(bin_list,15) | |
| ''' | |
| performance = timeit.repeat(setup = run_setup, |
NewerOlder