Author Topic: So I wrote my first Python module today :D  (Read 1789 times)

I'm learning how to do it through codeacademy.com, which is an amazing site. I took there tutorial and used my other knowledge about coding, so with out further ado, here it is: (It's supposed to be a pig Latin translator)

#Zero indexed function that returns the character at the specified length.
def char(string, index0, index1):
    if(not len(string)):
        return False
    else:
        return string[int(index0):int(index1)]

#Here we actually do the translation.

def pygLat(string):
    if(len(string) and string.isalpha()):
        return char(string.lower() + string.lower()[0] + "ay", 1, len(string.lower() + string.lower()[0] + "ay"))
    else:
        return False

Also, if any of you have pointers/things to fix/see a problem with this, please let me know.

ahh python
i remember when i started using it. i moved on when i realized its not that great. although i would embed it in c++ to use its support for extremely large integers which i love

ahh python
i remember when i started using it. i moved on when i realized its not that great. although i would embed it in c++ to use its support for extremely large integers which i love
whats so bad about it? also what other languages would you recommend learning?

whats so bad about it? also what other languages would you recommend learning?
javascript

c is good language for learning but c++ is much more practical.

whats so bad about it? also what other languages would you recommend learning?
at first i thought the syntax was great but looking at everything else in comparison its absolutely horrendous

its not fast and there barely is any good documentation

what do i recommend? what do i know. ive only played around with 3 languages. python c# and c++ and ive stuck with c++

C++ is, in my opinion, the most powerful modern programming language out there. It's extremely fast and has a lot less arbitrary limitations, and it isn't bull like assembly language. The main downside to C++ is that the implementations of it vary slightly on different platforms, so deploying code across multiple platforms can be tricky.

C++ is, in my opinion, the most powerful modern programming language out there. It's extremely fast and has a lot less arbitrary limitations, and it isn't bull like assembly language. The main downside to C++ is that the implementations of it vary slightly on different platforms, so deploying code across multiple platforms can be tricky.
Not a bad choice, that is, if you don't know asm like a *real* programmer.

ahh python
i remember when i started using it. i moved on when i realized its not that great. although i would embed it in c++ to use its support for extremely large integers which i love
There are other ways of doing that. there are many different arbitrary precision math libraries for C++. Not sure if any of them are as easy to use as pythons is...

There are other ways of doing that. there are many different arbitrary precision math libraries for C++. Not sure if any of them are as easy to use as pythons is...
What the forget have you been doing with your font?

Anyways, javascript is pretty fun to learn. C++ is next on my list though.

I'm learning how to do it through codeacademy.com, which is an amazing site.
It is a pretty good site, and python can be a useful language, but I see no point in sticking to python when you've learnt the basics. C++ and a few other languages can be quite fun, powerful and quite useful to learn.

Just some advice, and your code looks pretty neat and compact which is pretty good.


how2code?
use online resources buddy. there are tons of 'em. of course i'm way to lazy to actually learn coding.

jesus does it take effort, like tons.

use online resources buddy. there are tons of 'em. of course i'm way to lazy to actually learn coding.

jesus does it take effort, like tons.
Major in computer science and it becomes easy. Because stuff depends on you not being lazy. :)

isthay isyay ayay eryvay eatnay odulemay. oodgay objay.
oesday ityay anslatetray ackbay otay englishyay?