ibneko: (Default)
[personal profile] ibneko
I'm going to pick up Python (for Highbrow) and Ruby (for Warbook).

For python, I'm starting out by doing Project Euler.net: http://projecteuler.net/

That means for the next few days, you guys may be getting random notes from me regarding the strange things I encounter in the world of snakes and jewels.

Starting out with Python:
• print automagically adds a newline. Why?
(Also, slicing is kinda cool. I like the string_variable[4:9] notation..)
• Using commas to concat multiple things that aren't strings results in extra spaces. :/ Ick. Can turn it into a string by using str, or using printf style printing with %s, followed by %. Oh, perl, how you have spoiled me.
• The forced syntax based off of indenting and lack of semi-colon line-endings still bothers me. Suspect I'll get over it eventually... hopefully.
• Where's my +=...?
• And... I can't do i++ or i--? EHHH??!?!?

[edit #...6ish]
http://projecteuler.net/index.php?section=profile&profile=21827

Date: 2007-12-18 05:59 am (UTC)
From: [identity profile] jaiwithani.livejournal.com
+= works.
use + to concatenate without a space
to make print not automagically add a newline, add a comma on the end of the line
you'll get used to the indenting, especially if you set up your text editor with that in mind (there are some really god vimrc files out there).
++ and -- are not here. sowwy. +=1 and -=1 is the best you'll get.

Date: 2007-12-18 06:00 am (UTC)
From: [identity profile] jaiwithani.livejournal.com
also, I saw you on project euler's "online now" before I saw this post. I felt pretty creepy.

Date: 2007-12-18 06:07 am (UTC)
From: [identity profile] ibneko.livejournal.com
Hahaha, stalker :D

Yeah, figured out most things (not sure why I had issues with += earlier... that was quirky. Gone now though.), but thanks.

Date: 2007-12-18 06:08 am (UTC)
From: [identity profile] ibneko.livejournal.com
Mm, 38/172, eh? I must work faster and catch up ;D

Date: 2007-12-18 06:24 am (UTC)
From: [identity profile] jaiwithani.livejournal.com
My goal for the last few days has been beating Randall Munroe's score of 35, which I've now done. He hasn't been online for a while, though, so my new goal is to keep ahead of anyone I know on the site - which is currently you and one other person.

Fun fact: We are all amateur-ish python programmers.

Date: 2007-12-18 06:40 am (UTC)
From: [identity profile] ibneko.livejournal.com
Garh, I should probably stop bruteforcing these. Sooo not efficient.

Date: 2007-12-18 07:08 am (UTC)
From: [identity profile] jaiwithani.livejournal.com
Eh, s long as it finds the answer quickly I wouldn't worry too much about efficiency right now. There are some where bruteforcing is just not efficient, but as long as it finishes in under a minute its generally considered kosher.

So far the only one where the algorithm took a while to run was #23 - my solution took about 40 seconds to run, so I'm guess it was grossing inefficient. Probably later I'll read the solutions thread and learn how to do it properly.

Expand Cut Tags

No cut tags

Profile

ibneko: (Default)
ibneko

Most Popular Tags

Style Credit

Page generated Jan. 21st, 2026 02:45 am
Powered by Dreamwidth Studios
January 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2021