Stop learning alone!

Learn faster and stay on-track by joining this free class with other self-learners.

Register for MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming now.

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming

Class length: 24 weeks. Start anytime.

Creator: duallain

Status: Established

Join this class!

Ps2: I'm a little confused here. I'm getting it to loop

This code keeps looping in the 4th line. Don't understand why. Can anyone help ? (I don't want a solution tough, just guidance....

Counter=0 Prime=3 while (Counter<1000): #as long as the number of found primes is less than 9 if (Prime%2)==0: #if the number is even or odd Prime=Prime+1 #go to the next prime else: #if the prime is not even, which means odd for div in range(2, (Prime/2)+1): if Prime%div==0: Prime=Prime+1 else: Prime=Prime+1 Counter=Counter+1 print Prime

Gpyti
1 year ago

Reply


* Markdown Cheatsheet:

Link:
[clickable text](http://www.example.com)

New Paragraph:
Hit enter twice

Main heading:
# Main Heading Text

Sub-heading:
## Sub-heading Text

List:
* item 1
* item 2
* item 3

Italics:
*italicized text*

Bold:
**bold text**

YouTube:
URL (http://www.youtube.com/watch?v=Ui4AYPcRkYE) turns into embed code

Full Markdown reference