Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 13th, 2005, 9:16 PM   #1
SaturN
Programmer
 
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4 SaturN is on a distinguished road
Post Anyone got a small project idea??

I am very new to python have read as many tutorials and threads as my little brain can handle, and i want to make a little project, something to help me understand python more, but in all honesty, i dont know what python can do, and what i can get it to do, i am not looking for anything over the top, just something simple, that will help me on my way, Has any one got any ideas, and can they give me tips on making it. Thanks in advance
SaturN is offline   Reply With Quote
Old Apr 13th, 2005, 9:19 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,798
Rep Power: 5 Sane will become famous soon enough
Python can do anything (well not ANYTHING). It's an amazing language.

I wanna first see what you can do with it so far.

Um...create a program that tests to see if the number you input is prime or not.

If you can't do that, try making a program that prints 2 to the power of 1, then 2 to the power of 2, etc all the way up to the power of 22 (in a for loop).
Sane is offline   Reply With Quote
Old Apr 13th, 2005, 9:46 PM   #3
thechristelegacy
Expert Programmer
 
thechristelegacy's Avatar
 
Join Date: Jul 2004
Location: Somerset, Pa
Posts: 707
Rep Power: 4 thechristelegacy is on a distinguished road
Send a message via AIM to thechristelegacy Send a message via MSN to thechristelegacy
The prime one is good, you could also try to write a program that calculates the fibinochi sequence. Ex. 1 1 2 3 5 8 13 21 34 55 etc
thechristelegacy is offline   Reply With Quote
Old Apr 13th, 2005, 9:48 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,798
Rep Power: 5 Sane will become famous soon enough
That one is usually explained in the generic tutorial though, at least the one I read. I thought I'd exclude it. =P

I just thought I'd randomly through in that loop one to test his ability to handle arguments in a loop.
Sane is offline   Reply With Quote
Old Apr 13th, 2005, 9:48 PM   #5
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,462
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
how about a few functions to read and write files?
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Apr 13th, 2005, 9:52 PM   #6
SaturN
Programmer
 
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4 SaturN is on a distinguished road
The to the power of is straight forward i think
 for x in range(1,22)
       print x*x
But the primary numbers has got me, :p
I was thinking of checking to see if a base number was equal to the number given, if not add another number and check again, but it seems sloppy..

Last edited by SaturN; Apr 13th, 2005 at 9:54 PM. Reason: code error
SaturN is offline   Reply With Quote
Old Apr 13th, 2005, 9:54 PM   #7
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,798
Rep Power: 5 Sane will become famous soon enough
That doesn't explore the basic of Python too well though. =\ I don't even know how to read and write files yet. That's just like textbook information, he needs something that elaborates on what he may know. =P

I actually found RPG uses extremely basic functions of Python, I'm really having a blast programming this thing. Sure, there are some complicated parts, but all in all it's just keeping track of variables and using conditions to test them.

Once I see what you can do, I'll give you some recommendations for where to start.
Sane is offline   Reply With Quote
Old Apr 13th, 2005, 9:56 PM   #8
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,798
Rep Power: 5 Sane will become famous soon enough
Quote:
Originally Posted by SaturN
The to the power of is straight forward i think
 for x in range(1,22)
       print x*x
But the primary numbers has got me, :p
I was thinking of checking to see if a base number was equal to the number given, if not add another number and check again, but it seems sloppy..
You're on the right track. But that actually does squares.

1 x 1
2 x 2
3 x 3.

I asked for:

2 x 2
2 x 2 x 2
2 x 2 x 2 x 2

(Hint: ** does exponent subscript.)
Sane is offline   Reply With Quote
Old Apr 13th, 2005, 10:01 PM   #9
SaturN
Programmer
 
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4 SaturN is on a distinguished road
Do i just change
print x*x
For
print x**x
or am i just being hopefull, thanks for your help btw.
SaturN is offline   Reply With Quote
Old Apr 13th, 2005, 10:03 PM   #10
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,798
Rep Power: 5 Sane will become famous soon enough
When you think variables, think constants, and dependents.

You need the constant 2, and the dependent 1 through 22.

So far, you've got x**x. But those are both dependents on the values 1 through 22. You missed the constant.


Help with Prime code: % checks for the remainder of division.

So 3%2 = 1 because when you divide 3 into groups of two, you end up with one group of two, and a remainder of one.

Same to 16%5 = 1 and 18%6 = 0

There is a distinct rule with primes and remainders. :p

Last edited by Sane; Apr 13th, 2005 at 10:05 PM.
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:37 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC