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
# 6.00x Problem Set 5 | |
# | |
# Part 2 - RECURSION | |
# | |
# Problem 3: Recursive String Reversal | |
# | |
def reverseString(aStr): | |
""" | |
Given a string, recursively returns a reversed copy of the string. |
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
# 6.00x Problem Set 5 | |
# | |
# Part 1 - HAIL CAESAR! | |
import string | |
import random | |
WORDLIST_FILENAME = "words.txt" | |
# ----------------------------------- |
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
# 6.00x Problem Set 4A Template | |
# | |
# The 6.00 Word Game | |
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens> | |
# Modified by: Sarina Canelake <sarina> | |
# | |
# | |
# Implemented by: Fumiya Nakamura <nafu> | |
# |
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
# 6.00 Problem Set 3 | |
# | |
# Hangman game | |
# | |
# ----------------------------------- | |
# Helper code | |
# You don't need to understand this helper code, | |
# but you will have to know how to use the functions | |
# (so be sure to read the docstrings!) |
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
<!DOCTYPE HTML> | |
<html lang="ja-JP"> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<title>D3Circle</title> | |
</head> | |
<body> | |
<div id="D3line"></div> | |
<script type="text/javascript"> |
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
<!DOCTYPE HTML> | |
<html lang="ja-JP"> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<title>D3line</title> | |
</head> | |
<body> | |
<div id="D3line"></div> | |
<script type="text/javascript"> |
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 gcdIter(a, b): | |
''' | |
a, b: positive integers | |
returns: a positive integer, the greatest common divisor of a & b. | |
''' | |
testValue = min(a, b) | |
# Keep looping until testValue divides both a & b evenly | |
while a % testValue != 0 or b % testValue != 0: |
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
#!/bin/sh | |
# read data | |
sed -n '9,38p' weather.dat | \ | |
# check min | |
awk 'NR==1{min=100} min > $3{min=$3; print min}' | \ | |
# print the minimum value | |
tail -n 1 | |
# below data is for learning |
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
Source <a | |
href="http://sunsite.tut.fi/rec/riku/soccer_data/tab/93_94/table.eng0.01_02.html">sunsite.tut.fi/rec/riku/soccer_data/tab/93_94/table.eng0.01_02.html</a> | |
<pre> | |
Team P W L D F A Pts | |
1. Arsenal 38 26 9 3 79 - 36 87 | |
2. Liverpool 38 24 8 6 67 - 30 80 | |
3. Manchester_U 38 24 5 9 87 - 45 77 | |
4. Newcastle 38 21 8 9 74 - 52 71 | |
5. Leeds 38 18 12 8 53 - 37 66 |
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 chop(target, search_array): | |
if target in search_array: | |
return search_array.index(target) | |
else: | |
return -1 |