![]() |
|
#1
|
|||
|
|||
Program for PrimeI am doing an assignment of a program that prints out all the prime numbers between two values which the user provides.
AND we're suppose to start with num= input ("enter starting number") and do likewise to get the stopping number. then after outputting all the primes the program is to query the user to see if it is desired to do another run. with ans= raw-input("again (y/n)") please help |
|||
|
#2
|
||||
|
||||
Re: Program for PrimeSo what's the problem? You want someone to do it for you? If so, that won't happen here.
Try writing the program and see how far you get. If you post what you come up with to this forum, you are more likely to get assistance. Most of the members here have no problem helping out others, but you have to give us something to work with. __________________
Start Programming with Python-A beginner's guide to programming and the Python language. ------------- Common Sense v2.0-Striving to make the world a little bit smarter. |
|
#3
|
|||
|
|||
Re: Program for PrimePython Code:
THIS IS THE CODE THAT I HAVE BUT I DON'T KNOW HOW TO ENTER THE LOOP FOR IT TO BE ONLY BETWEEN TWO NUMBERS. Last edited by admin : 01-Mar-2009 at 23:47.
Reason: Please insert your example Python codes between [PY] and [/PY] tags
|
|
#4
|
||||
|
||||
Re: Program for PrimeCurrently it is printing all numbers from 2 to whatever the input number is. You never call for a second number to be input so it will never ask for the second number.
Basically what you need to do is ask for the starting and ending numbers. You have the function to determine the prime numbers; all you have to do is rewrite your loop to iterate through the isprime() function, making sure that the user-given numbers are used as the range. I also got 2 DeprecationWarnings about integers being expected but float values being given on lines 4 and 14. You may want to look into those but I don't know if you get the same errors. I'm using Python 2.5.1. __________________
Start Programming with Python-A beginner's guide to programming and the Python language. ------------- Common Sense v2.0-Striving to make the world a little bit smarter. |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Equation solver | RazoR | C Programming Language | 3 | 18-May-2008 10:24 |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 11:13 |
| BOOKEEPING program, HELP!! | yabud | C Programming Language | 10 | 17-Nov-2006 04:48 |
| Help with a complex program | lordfuoco | C++ Forum | 5 | 24-Jun-2006 07:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The