Fires of Heaven Guild Message Board  

Go Back   Fires of Heaven Guild Message Board > Fires of Heaven Related Forums > Uberworlds Development Forum
User Name
Password
Or, use your gamerDNA username: (more...)
ForumSpy Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 01-24-2009, 10:30 AM   #1 (permalink)
Etruscus
Registered User
 
Join Date: Nov 2003
Location: Dutchess co
Posts: 94
-6 Internets
Python 3.0

I'm trying to teach myself Python 3.0 and I have very limited programing skills. My preferred form of learning is kinetic (learning by doing). I am reading the design documentation and without examples to program (that are meaningful) it's hard for me to grasp what is going on. There is only one book out right now for 3.0. I was wondering if any of you know of a website or resource I can use to get assignments or challenges to program at a beginner skill level?
__________________
Etruscus - EQ2 - AB - Mistwalkers
Etruscus is offline   Reply With Quote
Old 01-24-2009, 12:10 PM   #2 (permalink)
Throag
Registered User
 
Join Date: Aug 2002
Location: Paris
Posts: 375
+1 Internets
Python 2.x is not that different from Python 3.0. You might want to start learning with it because there are A LOT more resources on the net about Python 2.x than 3.0. It's not compatible but I'm sure beginners program aren't complicated enough that it would be a problem.
Anyway, there was some list somewhere of the differences in 3.0, I'm sure you can find it pretty easily and then convert whatever program you wrote during your learning if you really want to keep them.
Throag is offline   Reply With Quote
Old 01-24-2009, 01:50 PM   #3 (permalink)
Froofy-D
upper management material
 
Froofy-D's Avatar
 
Join Date: Nov 2002
Location: Orlando, FL
Posts: 2,197
+17 Internets
Yeah learning by doing is about the only way to learn programming. It is a lot like math. Reading about math doesn't help as much as applying it to a lot of problems.
Froofy-D is offline   Reply With Quote
Old 01-24-2009, 03:50 PM   #4 (permalink)
Rufus
Registered User
 
Join Date: Sep 2002
Posts: 57
python.org has the tutorial for 3.0 complete already.

Python 2.x (2.6 currently) and 3.0 are different enough that a not-insignificant portion of the old-guard python folk are kinda ticked at the direction the language has gone (personally, the new string formatting stuff drives me batty).

But 3.0 was in part designed with people new to the language in mind and to that end, they've done a pretty good job with it as far as I've seen.

2.6 is going to have a lot of resources and it's a good place to start, but try the 3.0 tutorial first unless you're going to have to support 2.6 code immediately. If you learn the 2.x branch first, there are a few common things you'll have to unlearn that, in a pinch, you can import into 2.6 from 3.0 with the 'from future' directive if absolutely necessary.
Rufus is offline   Reply With Quote
Old 01-24-2009, 04:03 PM   #5 (permalink)
Throag
Registered User
 
Join Date: Aug 2002
Location: Paris
Posts: 375
+1 Internets
Quote:
Originally Posted by Rufus View Post
2.6 is going to have a lot of resources and it's a good place to start, but try the 3.0 tutorial first unless you're going to have to support 2.6 code immediately. If you learn the 2.x branch first, there are a few common things you'll have to unlearn that, in a pinch, you can import into 2.6 from 3.0 with the 'from future' directive if absolutely necessary.
I like being able to import stuff from the future
I also love being able to type "import antigravity" and get a result...

<3 python
Throag is offline   Reply With Quote
Old 01-24-2009, 04:19 PM   #6 (permalink)
Rufus
Registered User
 
Join Date: Sep 2002
Posts: 57
try:

Code:
from __future__ import braces
Rufus is offline   Reply With Quote
Old 01-24-2009, 05:46 PM   #7 (permalink)
Etruscus
Registered User
 
Join Date: Nov 2003
Location: Dutchess co
Posts: 94
-6 Internets
Quote:
Originally Posted by Rufus View Post
2.6 is going to have a lot of resources and it's a good place to start, but try the 3.0 tutorial first unless you're going to have to support 2.6 code immediately. If you learn the 2.x branch first, there are a few common things you'll have to unlearn that, in a pinch, you can import into 2.6 from 3.0 with the 'from future' directive if absolutely necessary.
I want to learn Python so I can write a program to calculate a specific type of financial asset that is priced multi-dimensionally. I need to be able to price using the monte-carlo method X2, but for the second run it would need a random walk generator (to simulate random walks in the interest rate).

The gui would need to allow for entry of up to 25 years, where an event has a certain likelihood of occurring every year, summing to 1000. This distribution looks more or less random, but it has a slight kurtosis. The distribution is empirical as well.

Excel just can't handle the level of computation that I need. I'm not on any kind of deadline, since they don't know I'm working on it. It occurred to me a couple weeks ago that calculating this asset by using the IRR iterative algorithm was leading to errors, since it always assumes anything reinvested would be reinvested at that specific IRR, and of course your discount rate changes as the market changes, so your output will always be erroneous.

For this project, learning 2.5 or 2.6 would be fine. But, I'm a computer gaming nerd at heart and I want to learn 3.0 to get a better understanding of what it means to actually run a large project like an MMO. I don't think there is a single computer game player in the market that hasn't said "I can do this better" and if they haven't, they are a console player Since 3.0 is the future, i think it makes sense to learn 3.0, even though very little is supporting right now.
__________________
Etruscus - EQ2 - AB - Mistwalkers
Etruscus is offline   Reply With Quote
Old 01-24-2009, 05:51 PM   #8 (permalink)
Faille
Fires of Heaven Officer
 
Join Date: Jan 2002
Location: Melbourne, Australia
Posts: 3,364
+25 Internets
maybe try delphi. its a totally different language but its got tight db integration and very easy to construct a gui. I used it to write a program that recalculates a person's mortgage to find out any errors about 12 years ago so it should be able to do what you're after.
__________________
Faille
Fires of Heaven
http://www.fohguild.org/forums/uberw...lopment-forum/
Faille is offline   Reply With Quote
Old 01-24-2009, 05:57 PM   #9 (permalink)
prescient63
Registered User
 
Join Date: Jan 2002
Posts: 1,918
-42 Internets
Quote:
Originally Posted by Etruscus View Post
I want to learn Python so I can write a program to calculate a specific type of financial asset that is priced multi-dimensionally. I need to be able to price using the monte-carlo method X2, but for the second run it would need a random walk generator (to simulate random walks in the interest rate).

The gui would need to allow for entry of up to 25 years, where an event has a certain likelihood of occurring every year, summing to 1000. This distribution looks more or less random, but it has a slight kurtosis. The distribution is empirical as well.

Excel just can't handle the level of computation that I need. I'm not on any kind of deadline, since they don't know I'm working on it. It occurred to me a couple weeks ago that calculating this asset by using the IRR iterative algorithm was leading to errors, since it always assumes anything reinvested would be reinvested at that specific IRR, and of course your discount rate changes as the market changes, so your output will always be erroneous.

For this project, learning 2.5 or 2.6 would be fine. But, I'm a computer gaming nerd at heart and I want to learn 3.0 to get a better understanding of what it means to actually run a large project like an MMO. I don't think there is a single computer game player in the market that hasn't said "I can do this better" and if they haven't, they are a console player Since 3.0 is the future, i think it makes sense to learn 3.0, even though very little is supporting right now.
You ever think about learning matlab (based in C from what I understand) instead. I know a lot of quants use it for prototyping and then code it in C++. I know some people in the office also like mathematica for this type of thing as well.

Last edited by prescient63; 01-24-2009 at 06:11 PM..
prescient63 is offline   Reply With Quote
Old 01-25-2009, 03:08 AM   #10 (permalink)
Throag
Registered User
 
Join Date: Aug 2002
Location: Paris
Posts: 375
+1 Internets
Quote:
Originally Posted by Rufus View Post
try:

Code:
from __future__ import braces
Ahah, didn't know this one, thanks for the laugh
Throag is offline   Reply With Quote
Old 02-01-2009, 03:46 PM   #11 (permalink)
Grooverider
1234567890
 
Grooverider's Avatar
 
Join Date: Aug 2002
Location: Svenborgia
Posts: 1,299
Use/learn .net
Grooverider is online now   Reply With Quote
Old 02-03-2009, 01:00 PM   #12 (permalink)
MrGraham
The Next Orange
 
MrGraham's Avatar
 
Join Date: Sep 2006
Posts: 1,321
+11 Internets
I'm running through the Python intro for fun as well. My programming experience is limited to HTML, Coldfusion, PHP, and SQL, so this question might be stupid for people who have worked with C.

Question - the following lines are from one of the first pages of the tutorial.
Code:
>>> word = 'Help' + 'A'
>>> word
'HelpA'
>>> '<' + word*5 + '>'
''
Why does the last line have to have the " + "'s around word*5 to work?
Code:
>>> word*5
'HelpAHelpAHelpAHelpAHelpA'
>>> ''
''
>>> '<'word*5'>'
SyntaxError: invalid syntax (, line 1)
... even with the code tag it's still omitting some.

An Informal Introduction to Python — Python v3.1a0 documentation

That's the page, it's like halfway down, section on concatenates.

Don't understand why '<' + word*5 + '>' works but '<'word*5'>' does not.

Last edited by MrGraham; 02-03-2009 at 01:19 PM..
MrGraham is offline   Reply With Quote
Old 02-03-2009, 01:45 PM   #13 (permalink)
Camerous
-internets from anon retards mean jack
 
Camerous's Avatar
 
Join Date: Nov 2003
Location: Overthere next to that place
Posts: 2,720
-79 Internets
Quote:
Originally Posted by MrGraham View Post
Don't understand why '<' + word*5 + '>' works but '<'word*5'>' does not.
iirc '<'word*5'>' and '<' word*5 '>' are two separate things also. python reads spaces where as other programing languages do not. That's iirc don't forget. Been a while since I have tried to learn it.
__________________

Give me more -internets you little bishes!
Camerous is offline   Reply With Quote
Old 06-03-2009, 02:16 AM   #14 (permalink)
Zarcath
is a little tea pot.
 
Zarcath's Avatar
 
Join Date: Jan 2004
Location: Carlsbad CA
Posts: 6,465
+75 Internets
I've been trying to learn Python 3.0 on my own and I'm having problems getting user input to work. I'm not sure what the correct syntax is...

Code:
print ("There's a door to the north and road to the east.")

if input == north:
    print("You push your way through the door")
    else:
        print ("Which way do you want to go?")

if input == east:
    print("Something is preventing you from going that way")
    else:
        print ("Which way do you want to go?")
edit: so I figured out the input but typing East is returning with the North print. If I don't have the elif, typing North returns with both North and East prints.

Code:
print ("There's a house to the North and a cave to the East? ")
usercmd = input ("Which direction will you go?" )

if usercmd == ("North") or ("N"):
    print ("You move North towards the house.")

elif usercmd == ("East") or ("E"):
    print ("You attempt to enter the cave but find it is blocked.")
__________________

Last edited by Zarcath; 06-03-2009 at 03:45 PM..
Zarcath is offline   Reply With Quote
Old 06-07-2009, 09:49 AM   #15 (permalink)
Candiarie
Registered User
 
Candiarie's Avatar
 
Join Date: Jan 2003
Posts: 978
+0 Internets
Quote:
Originally Posted by MrGraham View Post
I'm running through the Python intro for fun as well. My programming experience is limited to HTML, Coldfusion, PHP, and SQL, so this question might be stupid for people who have worked with C.

Question - the following lines are from one of the first pages of the tutorial.
Code:
>>> word = 'Help' + 'A'
>>> word
'HelpA'
>>> '<' + word*5 + '>'
''
Why does the last line have to have the " + "'s around word*5 to work?
Code:
>>> word*5
'HelpAHelpAHelpAHelpAHelpA'
>>> ''
''
>>> '<'word*5'>'
SyntaxError: invalid syntax (, line 1)
... even with the code tag it's still omitting some.

An Informal Introduction to Python — Python v3.1a0 documentation

That's the page, it's like halfway down, section on concatenates.

Don't understand why '<' + word*5 + '>' works but '<'word*5'>' does not.
Assuming I'm not a complete idiot:
The +s concat those strings. Without that it has no idea what you're trying to do. It'd be like typing
5 3*5 5
into a calculator. It doesn't know that you're trying to add them together.


For the user input problem, you can print out the usercmd to see what it receives from the input(). That or run it through a debugger to find out why it's not working. Maybe remove the ORs to see if it works without. It's been a long time since I used Python 2 even so I'm not 100% on the syntax at all.
__________________
Candiarie is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

uberguilds network



All times are GMT -7. The time now is 08:01 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 RC6