klen


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

About Me

No description provided.

Classes

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming

Class status: Established
Role: Student
. 11% complete

Learning Vim from the inside

Class status: Established
Role: Student
. 0% complete

Submitted Assignments

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 2, HW 1
# Problem Set 1
# Name: Kirill Klenov
# Time: 0:29

def is_prime(n):
    if n == 0 or n == 1: return True
    for number in range(2,n - 1):
        if not n % number: return False
    return True

def get_primes(n = 1000):
    return [n for n in range(n) if is_prime(n)]

# Problem 1
for n in get_primes(): print n

from math import log

def problem_2(n):
    primes = get_primes(n)
    _sum = sum(map(lambda x: log(x), primes[2:]))
    return _sum, n, _sum / n

# Problem 2
print problem_2(400)
print problem_2(1400)

klen 1 year ago
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 1, HW 1
# Problem Set 0
# Name: Kirill Klenov
# Time: 0:04

last_name = raw_input("Enter your last name: ")
first_name = raw_input("Enter your first name: ")
print '%s\n%s' % (first_name, last_name)

klen 1 year ago