![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4
![]() |
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
![]() |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,798
Rep Power: 5
![]() |
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). |
|
|
|
|
|
#3 |
|
Expert Programmer
|
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
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,798
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4
![]() |
The to the power of is straight forward i think
for x in range(1,22)
print x*xI 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 |
|
|
|
|
|
#7 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,798
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#8 | |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,798
Rep Power: 5
![]() |
Quote:
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.) |
|
|
|
|
|
|
#9 |
|
Programmer
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4
![]() |
Do i just change
print x*x print x**x |
|
|
|
|
|
#10 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,798
Rep Power: 5
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|