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 censor(text, word): | |
word_length = len(word) | |
print(text) | |
print(word_length) | |
censored_word = word_length * '*' | |
print(censored_word) | |
separated_text = text.split() | |
print(separated_text) | |
update = [censored_word if x == word else x for x in separated_text] | |
print(update) |
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
wn = turtle.Screen() |
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
#!/usr/bin/env python | |
__author__ = 'Ernest' | |
import turtle | |
wn = turtle.Screen() | |
wn.bgcolor("lightgreen") # sets the background colour | |
wn.title("Hello, Ernest!") # set the window title | |
tess = turtle.Turtle() |
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
#!/usr/bin/python | |
# encoding: utf-8 | |
""" | |
Created: 01/07/15, 13:11 | |
Description: | |
Write a function called censor that takes two strings, text and word, as input. | |
It should return the text with the word you chose replaced with asterisks. | |
For example: censor("this hack is wack hack", "hack") should return "this **** is wack ****" |
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
#!/usr/bin/python | |
# encoding: utf-8 | |
""" | |
Created: 01/07/15, 11:14 | |
Description: | |
Define a function scrabble_score that takes a string word as input and returns the equivalent scrabble | |
score for that word. | |
Assume your input is only one word containing no spaces or punctuation. | |
As mentioned, no need to worry about score multipliers! |
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
#!/usr/bin/python | |
# encoding: utf-8 | |
""" | |
Created: 01/07/15, 11:14 | |
Description: | |
Define a function scrabble_score that takes a string word as input and returns the equivalent scrabble | |
score for that word. | |
Assume your input is only one word containing no spaces or punctuation. | |
As mentioned, no need to worry about score multipliers! |
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
#!/usr/bin/env python | |
__author__ = 'Ernest' | |
def scrabble_score(): | |
score = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, | |
"f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m": 3, | |
"l": 1, "o": 1, "n": 1, "q": 10, "p": 3, "s": 1, | |
"r": 1, "u": 1, "t": 1, "w": 4, "v": 4, "y": 4, |
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
#!/usr/bin/env python | |
import urllib | |
import xml.etree.ElementTree as ET | |
import cgi | |
import pyperclip | |
import sys | |
# TODO: read the xml file of the article in question to figure out where to add the doi. | |
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
#!/usr/bin/env python | |
__author__ = 'Ernest' | |
import urllib | |
import xml.etree.ElementTree as ET | |
import cgi | |
import pyperclip | |
import sys | |
# TODO: read the xml file of the article in question to figure out where to add the doi. |
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
<?xml version='1.0' encoding='utf-8'?> | |
<feed> | |
<title>dive into mark</title> | |
<subtitle>currently between addictions</subtitle> | |
<id>tag:diveintomark.org,2001?07?29:/</id> | |
<updated>2009?03?27T21:56:07Z</updated> | |
<link rel='alternate' type='text/html' href='http://diveintomark.org/'/> | |
<link rel='self' type='application/atom+xml' href='http://diveintomark.org/feed/'/> | |
<entry> | |
<author> |