meanmuggin


Joined 1 year ago
Homeworks submitted:
Homework comments:
3
0

About Me

No description provided.

Classes

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming

Class status: Established
Role: Student
. 17% complete

Submitted Assignments

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 3, HW 1
##x = input('Please enter number of nuggets you would like ')



packages = input('Input list of package sizes [a,b,c] ')

vec_len = len(packages)

abc_vars_limit = range(1,vec_len+1)


x = 0
limit = 100
num_n_log = []

while x < limit:


    m = 0
    while m < vec_len:
        abc_vars_limit[m] = x/packages[m]
        m += 1 

    ##print abc_vars_limit

    a = range(0,abc_vars_limit[0]+1)
    b = range(0,abc_vars_limit[1]+1)
    c = range(0,abc_vars_limit[2]+1)

    ##print a
    ##print b
    ##print c

    a2 = []
    b2 = []
    c2 = []
    abc = []

    for i in a:
        for j in b:
            for k in c:         
                if x == packages[0]*a[i]+packages[1]*b[j]+packages[2]*c[k]:
                  a2 = a2 + [i]
                  b2 = b2 + [j]
                  c2 = c2 + [k]

    if a2 == [] and b2 == [] and c2 == []:
    
     num_n_log = num_n_log + [x]
##    print a2
##    print b2
##    print c2
##    print num_n_log
    x += 1
## 
##
##
##
print 'These numbers cannot be bought in exact quantity'
print num_n_log
 
s = 'Given package sizes ' + repr(packages[0])+ ' ' + repr(packages[1]) + ' and ' + repr(packages[2]) + ' the largest number of McNuggets that cannot be bought in exact quantity is: ' + repr(num_n_log[-1])
print s 

meanmuggin 10 months ago
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 2, HW 1
Part 1

import math

nums = range(2,10000)

for i in range(2,10000):
    nums = filter(lambda x: x == i or x % i, nums)

    
nums2=nums[0:1000]

print nums2[999]

Part 2


import math

nums = range(2,10000)

for i in range(2,10000):
    nums = filter(lambda x: x == i or x % i, nums)

    
nums2=nums[0:1000]

print nums2[999]

n=input('Please enter a number n ')
num_logs=range(1,n+1)

num_logs2=0
i=0
while i<n:
    num_logs[i]=math.log(nums2[i])
    i = i + 1
print num_logs
num_sum=sum(num_logs)
print num_sum
ratio = float(num_sum)/float(nums2[n])
print nums2[n]
print ratio

meanmuggin 10 months ago
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 1, HW 1
# Problem Set 0
 # Name: meanmuggin
 # Collaborators: N/A
 # Time: 1:00
 # 
 

first = raw_input("Enter your first name ");
last = raw_input("Enter your last name ");

print first, last

meanmuggin 1 year ago