About Me
I've had a passion for computers my whole life, but now at 30, I'm just realizing I should have made it my career. I know general maintenance and repair fairly well, but I want to get specialized. In my mind you need to be able to talk to a computer before you can work with it. Which lead me to Python, which lead me to "MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming". How AWESOME is that! Not only is it MIT, he's teaching programming, and he's using Python, it was perfect fit for me! So here I go taking my first toddling step toward my towering career.. it's gonna be a bumpy ride!
Classes
|
Class status: Established
Role:
Student
|
.
11% complete
|
Submitted Assignments
 |
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 2, HW 1
I had to cheat a little bit with this code, couldn't take not knowing the answer. I don't remember seeing a lot of these concepts in the video, guess I need to do more reading.
number = int(raw_input("How many prime numbers would you like me to count? "))
counter = 1
prime = 3
while counter < number:
divisor = prime/2
while divisor > 1:
if prime % divisor == 0:
prime = prime + 2
divisor = prime / 2
else: divisor = divisor - 1
counter = counter + 1
prime = prime + 2
print "If you count", number, "prime numbers you will arive at %s." % (prime-2)
nim6us
1 year ago
|
 |
|
|