Ask
your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW)
42 Online
I'm doing the intro to programming/python, if anyone else is running through it and would like to share some code/examples/problem, my email is snibor.ds@gmail.com Thanks
Still Need Help?
Join the QuestionCove community and study together with friends!
I think this works: ps1.py def isPrime(n): # this is a function created by me ri = 2 rf = n / 2 isPrim = 1 # yes for b in range(ri, rf+1): mod = n % b if mod == 0: isPrim = 0 # no return isPrim x = 2 lastPrime = 0 numbPrime = 1000 while lastPrime < numbPrime: # range from 0 to 999, i.e. 1000 if isPrime(x): # call function isPrime() print x lastPrime = lastPrime + 1 x = x + 1 Try: c:\Python27\ps1.py > ps1.txt to see the results in a .txt file.
Can't find your answer?
Make a FREE account and ask your own questions, OR help others and earn volunteer hours!
Join our real-time social learning platform and learn together with your friends!
Join our real-time social learning platform and learn together with your friends!
Latest Questions
CloverKris:
If I post the lyrics to a song; is that allowed? (With credits, ofc)
CloverKris:
how do I make a group chat/add people in a group chat?
Trickjoker:
My ranking of every song on every Nirvana album released before Kurts passing BLEACH This was very difficult to do because I love every song on this album!
Andydegummibear:
why do people make fun of a death of a husband father and loving person charlie k
Andydegummibear:
why do people make fun of a death of a husband father and loving person charlie k
dontcare:
whats the best place to get a first tattoo at? Its gonna be a skull with pink and
xXAikoXx:
Romanticism had its roots in the individualism of the ________________, the Reformation's reverence to God in his natural state, and The Englightenment's de
xXAikoXx:
Any particular thoughts on the Holocaust in Germany that happened between 1941 an
xXAikoXx:
Does anybody else have rapid changes in their weight? Sometimes I would lose a lot of weight, gain more, lose again, and the cycle continues lol.
1 hour ago
6 Replies
1 Medal
36 minutes ago
19 Replies
1 Medal
2 hours ago
3 Replies
0 Medals
1 hour ago
59 Replies
8 Medals
17 hours ago
0 Replies
0 Medals
16 hours ago
9 Replies
0 Medals
18 hours ago
2 Replies
2 Medals
17 hours ago
2 Replies
0 Medals
20 hours ago
15 Replies
2 Medals