Ahmad


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

About Me

No description provided.

Classes

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming

Class status: Established
Role: Student
. 11% complete

Submitted Assignments

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 2, HW 1

This is my solution for Problem 1 but the output gives me "7927" which is the 1001th prime

prime = 1 
count = 1
divisor = prime-2
while count<1000:
    prime += 2
    divisor = prime-2
    while divisor>1:
        if prime%divisor == 0:
            divisor = 0
        else :divisor -= 2
        if divisor == 1:
            count += 1 
print 'The 1000th prime is', prime
            

Ahmad 1 year ago
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 1, HW 1
 # Problem Set 0
 # Name: Ahmad
 # Collaborators: None
 # Time: about 5 minutes
 
LastName = raw_input('Enter your last name')
FirstName = raw_input('Enter your first name')
print('Your name is'), FirstName, LastName

Ahmad 1 year ago