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 nltk.tokenize import sent_tokenize | |
def lines(a, b): | |
"""Return lines in both a and b""" | |
(a, b) = (a.split('\n'), b.split('\n')) | |
# TODO | |
return [line for line in a if line in b] |
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
import sys | |
if len(sys.argv) != 2: | |
print("Usage: python3 caesar.py key") | |
sys.exit(0) | |
key = int(sys.argv[1]) | |
message = input("enter a secret message: ") | |
def cipher(letter, key): |
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
cash = float(input("please enter cash amount to break down into coins (example 1.25): ")) | |
coins = {"quarters": .25,"dimes":.10,"nickels":.05,"pennies":.01} | |
for key, coin in coins.items(): | |
(coins[key], cash) = (divmod(cash,coin)[0], round(divmod(cash,coin)[1],2)) | |
print(coins) |
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
height = int(input("enter a number for your mario pyramid: ")) | |
for i in range(2, height+2): | |
print(('#'*i).rjust(height+1), end=" ") | |
print('#' * i) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>css example</title> | |
<!-- starting css rules --> | |
<style type="text/css"> | |
/*css comment*/ | |
button{ | |
font-size: 17px; |
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 plusNineThousandDecorator(function): | |
def wrapper(number): | |
return function(number) + 9000 | |
return wrapper | |
@plusNineThousandDecorator | |
def returnPositiveNumber(number): | |
if number > 0: | |
return number |
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 cs50 import get_string | |
from student import Student | |
# Space for students | |
students = [] | |
# Prompt for students' names and dorms | |
for i in range(3): | |
name = get_string("name: ") | |
dorm = get_string("dorm: ") |
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
#compare two strings from user input | |
from cs50 import get_string | |
import sys | |
def main(): | |
stringOne = get_string("enter string one: ") | |
stringTwo = get_string("enter string two: ") | |
if stringOne != stringTwo: | |
print("They are NOT the same!") |
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
#Extract users initials | |
from cs50 import get_string | |
import re | |
def main(): | |
userName = get_string("enter full name: ") | |
print(getInitials(userName)) | |