?

Log in

No account? Create an account
entries friends calendar profile Previous Previous Next Next
Random goals for the next few days / break - IBNeko's Journal-Nyo~!
ibneko
ibneko
Random goals for the next few days / break
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

Tags: , , ,

7 happy kittens | Leave catnip
Comments
jaiwithani From: jaiwithani Date: December 18th, 2007 05:59 am (UTC) (Link)
+= 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.
jaiwithani From: jaiwithani Date: December 18th, 2007 06:00 am (UTC) (Link)
also, I saw you on project euler's "online now" before I saw this post. I felt pretty creepy.
ibneko From: ibneko Date: December 18th, 2007 06:07 am (UTC) (Link)
Hahaha, stalker :D

Yeah, figured out most things (not sure why I had issues with += earlier... that was quirky. Gone now though.), but thanks.
ibneko From: ibneko Date: December 18th, 2007 06:08 am (UTC) (Link)
Mm, 38/172, eh? I must work faster and catch up ;D
jaiwithani From: jaiwithani Date: December 18th, 2007 06:24 am (UTC) (Link)
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.
ibneko From: ibneko Date: December 18th, 2007 06:40 am (UTC) (Link)
Garh, I should probably stop bruteforcing these. Sooo not efficient.
jaiwithani From: jaiwithani Date: December 18th, 2007 07:08 am (UTC) (Link)
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.
7 happy kittens | Leave catnip