Subscribe to the activity stream RSS Feed
Homework: Lesson 2, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming##PS1
##Rob
#Problem 1
from math import *
def primeTest(candidate):
prime=True
if candidate%2==0: # if candidate is even,
prime=False
else:
divisor=3
while divisor <= candidate/2 and prime==True:
if candidate%divisor==0: #if candidate can be ...
|
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming# Problem Set 0
# Name: Rob
first_name = raw_input('Enter your first name: \n')
last_name = raw_input('Enter your last name:\n')
print first_name, last_name
|
Homework: Lesson 3, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming#!/usr/local/bin/python ## Problem 1. ## Show that it is possible to buy exactly 50, 51, 52, 53, 54, and 55 McNuggets, by finding solutions to the Diophantine equation. You can solve this in your head, using paper and pencil ... |
Homework: Lesson 2, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingStraight forward assignment. The logarithm portion took me awhile to code. My math skills are rusty. #!/usr/local/bin/python ## Problem 1. Write a program that computes and prints the 1000th prime number. ## This problem took just over one hour to program. # start with the first candiate candidates = [1,3] # start with the know primes primes ... |
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingPretty quick and easy assignment. # Problem Set 0
# Name: Scott Brenner
# Collaborators: None
# Date: 2011-01-04
# Start time: 7:05 PM
# End time: 7:18 PM
#
print ('Problem Set 0')
print ('Problem 1')
var_lname = raw_input('What is your last name?')
#get user input and assign it ...
|
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingProblem Set 0Name : Chris TangCollaborators: NonyabusinazTime:1:32firstname=raw_input ('What is your first name?: ') lastname=raw_input('What is your last name?: ') print 'Your name is:',firstname, lastname #Problem Set 0
#Name : Chris Tang
#Collaborators: Nonyabusinaz
#Time:1:32
#
firstname=raw_input ('What is your first name?: ')
lastname=raw_input('What is your last name?: ')
print 'Your name is:',firstname, lastname
|
Homework: Lesson 1, HW 1in Programming in Cincludeint main(int argc, const char * argv[]) { printf("Hello, world!n"); return 0; } #include <stdio.h>
int main(int argc, const char * argv[]) {
printf("Hello, world!\n");
printf("\c");
return 0;
}
warning: unknown escape sequence '\c'
|
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingProblem Set 0 #Problem Set 0
#Name : Chris Tang
#Collaborators: Nonyabusinaz
#Time:1:32
#
firstname=raw_input ('What is your first name?: ')
lastname=raw_input('What is your last name?: ')
print 'Your name is:',firstname, lastname
|
Topic: Zaczniesz obserwowa? na pozycjonowanie w charakterze na ?ród?o dochodu, wzmo?enie presti?u okolica, natomiast plus jej ogl?dalno?ci.in the Programming ForumJaros?aw Kaczy?ski by? charyzmatycznym liderem, lecz w tej chwili obecnie nim nie jest. Nie pokazuje, o jak? Polsk? chce naparza? si?. On walczy tylko z Donaldem Tuskiem. Toczy prywatn? wojn?. Usz?o spo?ród niego owo powietrze lidera ... |
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programmingproblem set 0casparlastname= raw_input ('what is your last name')
firstname= raw_input ('what is your first name')
print lastname,firstname
|
Homework: Lesson 11, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming# 6.00 Problem Set 6
#
# The 6.00 Word Game
#
import time
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i ...
|
Homework: Lesson 3, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingProblem set 2 # Problem set 2.1a # Shemmerson # Show that it is possible to buy exactly 50, 51, 52, 53, 54, and 55 McNuggets, by finding # solutions to the Diophantine equation. a = 6 b = 9 c = 20 for n in range(50, 56 ... |
Homework: Lesson 2, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingPs1a Ps1b # Problem set 1a
# Name: Shemmerson
# Collaborators: CuriousReef
# Time: 2 Hrs
#finds 1000th prime
y = 1000
x=2
count=1
print "Finding 1000th prime"
while count<=y:
prime=True
for test in range (2, x):
if x%test == 0:
prime=False ...
|
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and ProgrammingFirst assignment for MIT 6.00 OpenCourseWare #Problem set 0
#Name: Shemmerson
#Time: 0.10
#ask for and print out a users last and first names
L = raw_input('Please enter your last name: ')
F = raw_input('Please enter your first name: ')
print F + ' ' + L
|
Homework: Lesson 9, HW 2in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming# Problem Set 5: Ghost
# Name: Andrew
# Collaborators: CuriousReef
# Time:
#
import random
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
import string
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase ...
|
Homework: Lesson 9, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming
# Problem Set 5: 6.00 Word Game
# Name:
# Collaborators:
# Time:
#
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j ...
|
Homework: Lesson 1, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programmingfname = raw_input("Howdy, what's your first name?")
lname = raw_input("And your last?")
print fname, lname
|
Homework Comment: wolfei's HomeworkI tried your code and it works, however most other Prime number testers have a line somewhere that goes something like this while (n <= (number**.5)): It is the half value being used in the test I am talking about ... |
Homework: Lesson 2, HW 1in MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming#Problem Set 1
#Name: Andrew
#Collaborators: CuriousReef
#Time:
from math import *
#problem 1
def isPrime(num):
if num < 2:
return False
if num == 2:
return True
if num % 2 == 0:
return False
for i in range(3,int(ceil(sqrt ...
|