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 PUBLIC "-//W3C//DTD XHTML 1.0 Traditional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" | |
lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" | |
xmlns:og="http://opengraphprotocol.org/schema/"> | |
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
# Exercise 1.7 | |
# Rock, Paper Scissors game | |
## TODO: lower case user input | |
player1 = raw_input('Player 1? ') | |
# make sure player1's play is one of rock, paper or scissors | |
while (player1 != 'rock' and player1 != 'paper' and player1 != 'scissors'): | |
print "You wrote: " + player1 | |
player1 = raw_input('Please enter one of the following, "rock", "paper" or "scissors": ') |
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
# OPT.2 from http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2011/assignments/MIT6_189IAP11_hw1.pdf | |
# Secret Messages | |
phrase = raw_input("Enter sentence to encrypt: ") | |
shift = input("Enter shift value: ") | |
encoded_phrase = '' | |
for c in phrase: | |
ascii = ord(c) | |
if 97 <= ascii < (97+26): |
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
# ********** Exercise 2.5 ********** | |
# code for roots function | |
# given the coefficients for a quadratic equation | |
# returns the two roots | |
# if the roots are complex, exit | |
def find_roots(a,b,c): | |
# give up if the roots are complex | |
assert not roots_are_complex(a,b,c) | |
d = math.sqrt(b**2 - 4*a*c) |
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
<div style="padding-left: 7px; background-image: url("/about/about-banner.jpg"); background-repeat: no-repeat;"><br /> | |
<br /> | |
<h1>Unlocking Knowledge,<br /> | |
Empowering Minds.</h1> | |
<p>Free lecture notes, exams, and videos from MIT. No registration required.</p> | |
<p> </p> | |
</div> | |
<p> </p> | |
<p>MIT OpenCourseWare (OCW) is a web-based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity.</p> | |
<h2 class="subhead">What is MIT OpenCourseWare?</h2> |
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
<div style="FLOAT: left; WIDTH: 325px" class="photo"><img width="300" border="0" height="192" style="PADDING-RIGHT: 25px; PADDING-BOTTOM: 7px; PADDING-TOP: 8px" alt="MIT President Susan Hockfield." src="/about/presidents-message/kennedyhockfield_sm.jpg" /><br /> | |
<div style="PADDING-RIGHT: 25px; FONT-SIZE: 0.7em; PADDING-BOTTOM: 7px" class="caption instruction">MIT President Emeritus Susan Hockfield</div> | |
</div> | |
<p style="MARGIN-RIGHT: 20px">The goal of advancing education around the world is shared by the MIT Faculty. Indeed, we owe the existence of OpenCourseWare to the foresight, dedication, and generosity of our faculty. In the year 2000, a faculty committee first proposed this bold and innovative idea, and since then, the vast majority of our faculty–over 90%–have voluntarily contributed their teaching materials for free and open publishing on OCW. MIT faculty are passionate about their teaching, and they are keen to see their work benefit global society.</p> | |
<p>We do not yet know the full pot |
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 random | |
board = [] | |
for x in range(0,5): | |
board.append(["O"] * 5) | |
def print_board(board): | |
for row in board: | |
print " ".join(row) |
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
# ********** Exercise 2.8 ********** | |
import math | |
def report_card(): | |
##### YOUR CODE HERE ##### | |
count_classes = int(input("How many classes did you take? ")) | |
grade_book = {} | |
total = 0 |
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
<div id="bottom"> | |
<div id="grid"><!-- *begin footer* --> | |
<div id="footer" role="navigation sitemap"> | |
<div id="foot-c1" class="grid_2 alpha"> | |
<h4 class="footer">Courses</h4> | |
<ul class="foot-bullet"> | |
<li><a href="/courses/find-by-topic/">Find by Topic</a></li> | |
<li><a href="/courses/find-by-number/">Find by Course Number</a></li> | |
<li><a href="/courses/find-by-department/">Find by Department</a></li> | |
<li><a href="/courses/audio-video-courses/">Audio/Video Courses</a></li> |
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
<p><a id="top" name="top"></a>Do you have an OCW story? <a href="http://ocw.mit.edu/jsp/feedback.jsp?Referer=User_Stories">Share it with us</a>.</p> | |
<p><a href="#students">Students</a> | <a href="#educators">Educators</a> | <a href="#self-learners">Self Learners</a> | <a href="#supporters">OCW Supporters</a></p> | |
<p> </p> | |
<div class="clear"> </div> | |
<h2 class="subhead"><a id="students" name="students"></a>Students</h2> | |
<p><img alt="Photo of user Kunle Adejumo." style="padding-bottom: 40px; padding-right: 15px; float: left" src="/about/ocw-stories/kunle_th.jpg" /><a href="/about/ocw-stories/kunle-adejumo">Kunle Adejumo</a><br /> | |
Student<br /> | |
Nigeria<br /> | |
<br /> | |
Kunle Adejumo is finishing his fourth year of engineering studies at Ahmadu Bello University in Zaria, Nigeria. By all rights, he should now be in his fifth and final year, but local strikes and instability in Nigeria have added almost a full year to his studies at Ahmadu Bello. <a href="/about/ocw-stories/kunle-adejumo">Read more</a>.</p> |
OlderNewer