Sign in to follow this  

Well I choose python, but I am still confused

This topic is 3662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Awhile back I asked which programing language was best to start with, after see all the results that people told me I had decided to download python and use that. However I am now wondering if there is any previous knowledge I should know first. Also my friend keeps calling me a noob for saying I am going to start off with python and not java. Any help or advice is highly appreciated. Thanks - Goremanilius

Share this post


Link to post
Share on other sites
Smack your friend and call him a "holier-than-thou" idiot. [wink]

Actually, you have one compelling reason to not learn Python and to learn Java instead; your friend knows it. Having a friend to help you out is always nice, and is fun.

But back onto the topic. No there is no real prerequisites for learning Python. Just have patience and perseverance. Perhaps most of all, realize that creating a Hello World! program is still quite an achievement, even if it doesn't look like much. All progress is good and should be celebrated. Don't get your expectations too high up, and don't ignore your little steps thinking them to be insignificant or boring.

Beyond that, what help can we give? We don't really know *anything* about your problems. So, good luck.

Share this post


Link to post
Share on other sites
Well, first off you should ignore your 'friend'. I doubt he knows what he's talking about. Python is a perfectly fine place to start and if he's ignorant enough to mock you for your choice then he's probably not as awesome as he thinks he is.

Anyway, good previous knowledge... like what? You need to know very little math to start and other than that you just need decent reading comprehension. Get an introductory text/tutorial and that should fill you in. If you have done so and had problems with that then I guess try another resource and/or ask questions here over specific concepts you are having trouble with.

It'll probably take awhile until you know what you're doing. You'll copy something from your learning resource and think "I don't get this". But keep keep working at it. You'll notice patterns. Things will click. You should change some of the code around and see what happens. Experiment.

Good luck

Share this post


Link to post
Share on other sites
I suppose its best to program with a friend, but he would never have time for it anyways. I am not having nessesarily a problem, its just that when I downloaded python, the python tutorial it came with kinda confuses me. I AM an ABSOLUTE beginner. NO previous knowledge of programming. Is their an online tutorial somewhere online that can help someone like me?

Share this post


Link to post
Share on other sites
There really is a wealth of tutorials online for python. To begin, I would recommend poking around the documentation area of www.python.org. In particular, this is the tutorial I browsed when learning the language:
http://docs.python.org/tut/tut.html

Try working through the tutorials and posting questions when you run into problems.

Share this post


Link to post
Share on other sites
If your friend does not know Java Programming well enough to help you with Python programming basics, then he doesn't know enough to help you much with Java either.

While all programming languages are different, they share most of their foundations which someone who is an expert should have no trouble learning enough in a matter of hours to show a beginner programmer where to start.

Keep up with python, and follow the documents on python's site. It is a lovely little language, and if you run into problems post here and someone will help you over any bumps.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
Actually, you have one compelling reason to not learn Python and to learn Java instead; your friend knows it. Having a friend to help you out is always nice, and is fun.


If his friend calls him a noob, then his friend probably doesn't know much about anything [wink]

To the OP: you might want to look at the Python tutorials for absolute beginners.

Share this post


Link to post
Share on other sites
How to Think Like a Computer Scientist: Learning with Python

More than just teaching you Python, it teaches you problem solving and the cognitive skills that requires. It's been used in a high school setting and commended by a college educator. I recommend this to every Python and programming beginner.

(If you already know at least one programming language and just want to pick up Python, I recommend Dive Into Python.)

Share this post


Link to post
Share on other sites
I chose Python too. :-) I'm using and loving "A Byte Of Python". It's an e-book and you can find the link on the python.org "Absolute Beginners" page. Best of all it's free so ya can't beat the price. I've also bought a couple of reference books and those are on the way too. There are some mailing lists you can join from the site too. There's even one called "tutorial" for new learners.

Share this post


Link to post
Share on other sites
Well I have succesfully made the "Hello World!" program. Yay me. I used the documents mentioned earlier "A Byte of Python" But I am confused by one thing. I am using windows and I click on start-all programs-python 2.5-IDLE(python GUI) and once that was up In order to actually run the program I had to click on File-new window. The menus at the top of both are different. After I clicked on new window I typed print 'Hello World!' and saved it. then i clicked F5 to run it. It worked. But I need to know if what I am doing is the RIGHT way to get where I was.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gormanilius
But I need to know if what I am doing is the RIGHT way to get where I was.
It's a right way. As a beginner you just need to worry about getting things working - if a program you write meets the goals you're aiming for and doesn't have any nasty unintended other behaviors you can consider it correct, as you improve your knowledge you'll gradually learn how to recognise when there may be a better way to do things, but don't worry about that too much for now.


The first window you got when you opened IDLE is the interactive shell. You can type Python expressions into the shell and you'll immediately get results back. By typing "help(function-name)" (where function-name) is replaced with the name of an actual function) you can access some of the built in help information. The interactive shell is a great way to try out small snippets and experiment with new things that aren't too complex.

The second window you got when you chose "new window" from the file menu is where you'll write most of your programs using IDLE. You can find a few potentially useful tools on the menu of this window that you might want to learn a bit more about as you get more experienced, but for now the built-in error checking and run option are pretty much all you need to get started; running a program will often take you back to the interactive shell, but you'll now be able to use any additional functions you've defined, see any non-graphical output from your program, etc.


Hope that helps. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by Gormanilius
But I need to know if what I am doing is the RIGHT way to get where I was.


Yeah that's what I'm doing too (took me a while to figure it out). Like the guy before me said, that "new window" is where we'll be writing our actual games so it's probably the best place to put all the little practice programs given in the book.

Share this post


Link to post
Share on other sites
Ok I am on escaspe sequences now and I was having major problems. But them I looked at which slash I was using. I kept on using / instead of \ So just wondering if you made the same mistake.

*edit* That WAS one problem but I still have to use 3 ''' before and after and it states I can use only one ' before and after. Help?

Share this post


Link to post
Share on other sites
You're referring to """docstrings""". These can be used to document the behaviour of a function, so whenever you type help(function-name), the documentation string associated to that function is displayed.

Personally, I hardly ever use them. Whenever I feel a functions purpose is unclear, I add a comment to it, not a docstring. I prefer clearly descriptive function names over long documentations anyway.


Normal strings only need a single " or ' on each side, so Python knows where they start and end:
>>> print "This is a normal string. Yay!"
This is a normal string. Yay!
>>> print 'This works, too.\nNext line!'
This works, too.
Next line!

The \ indicates that a special character is coming up. \", for example, is seen as a ", but it won't end a string that's started with a ", so you can do the following:
>>> print "Print a \"..."
Print a "...

\\ prints a \, \n jumps to the next line, \t prints a tab, and so on. This isn't really critical to know about, but it can be usefull sometimes.

Share this post


Link to post
Share on other sites
Quote:
Original post by Captain P
You're referring to """docstrings""". These can be used to document the behaviour of a function, so whenever you type help(function-name), the documentation string associated to that function is displayed.


A docstring can use any form of quoting. The triple quotes are used to let you put return characters, as well as either single or double quotes, within the string without needing any escape sequences.

Quote:
Personally, I hardly ever use them. Whenever I feel a functions purpose is unclear, I add a comment to it, not a docstring. I prefer clearly descriptive function names over long documentations anyway.


Docstrings are for, well, documentation. Documentation isn't generally about a function's purpose; it's about the preconditions and postconditions.

Share this post


Link to post
Share on other sites
Thanks Captain P! That did help me past that little problem. I am saving different .py docs for me to reference later and those are pretty good examples. I may post another question in a little bit for I am continuing my training.

Share this post


Link to post
Share on other sites
Okay from what I understand you would use raw strings if you want something to print exactly like you typed it. For example if you type a string and you include \n it will move your text down to a new line. but if you don't want a new line and you actually wanted the end user to see the characters \n you have to use a raw string to make it show up.

Share this post


Link to post
Share on other sites

This topic is 3662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this