New Python user

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Re: New Python user

Post by SeachMall on Tue Sep 30, 2008 1:19 pm
([msg=12870]see Re: New Python user[/msg])

Argh! Are you listening to me?
Yeah, hence the 'Agree to disagree?'
However, the first few bits should be learnt and practiced in short
Yes and build on what you've done.

You seem to think you can't learn the basics while working on a project, you can. I've learn't PHP and Python by working on projects, they started out small and build up.

The Python project started out as a programme that outputs random cards that are stored in variables. Its now a full OOP blackjack game, its the first thing I ever did in python.

When you learn the basics you (or at least I did) look at something and think 'what is that useful for', its not until you apply it that realise why you need it.

Basically, you print 'Hello World', you then learn variables and store it in one, then your make it a function etc. but all with a goal.
how do you multiply if you can't add?
Bad analogy, not even comparable.

How do you learn to add without doing a sum?
Image
User avatar
SeachMall
New User
New User
 
Posts: 15
Joined: Wed Sep 17, 2008 5:11 pm
Location: Ireland
Blog: View Blog (0)


Re: New Python user

Post by liuyuan on Tue Sep 30, 2008 2:06 pm
([msg=12876]see Re: New Python user[/msg])

This is kind of off-topic, as the previous few posts, but I've actually found out that it's better to start writing things for fun before learning about all the variables. That way, you'd feel the need to learn about parts of programing. Which makes it more fun than just going through parts... Var, arry, switch, if and stuff... You'd find that eventually you'd just get better and better at things :>
ImageImageImage
liuyuan
Experienced User
Experienced User
 
Posts: 64
Joined: Mon Apr 14, 2008 10:17 pm
Blog: View Blog (0)


Re: New Python user

Post by thedotmaster on Tue Sep 30, 2008 2:16 pm
([msg=12879]see Re: New Python user[/msg])

SeachMall wrote:Bad analogy, not even comparable. How do you learn to add without doing a sum?


Even worse analogy. You can't, of course you can't. What I'm saying is that you cannot work out the area of a circle and learn to add while you're at it.
There is more to programming than a load of syntax. There are parts to programming that are pure theory - for example, AND/OR/NOT logic gates as only one example. There is also a lot about technique. If you learn this on the fly you will learn only the minimum to complete the project, you will not get maximum code efficiency and basically - you will never be a good programmer.
This is how I will learn a programming language:

+ Read about displaying text and how to assign variables, including variable naming.
+ Try a simple hello world program, try assigning "hello" to one variable and "world" to another.
+ Read about more complex string manipulation and certain string functions.
+ Test things such as len("aaa"). Have a little mess around.
+ Read about loops and IF statements.
+ As I'm going along trying little exercises.
+ Complete a few exercises that incorporate all the techniques I've learnt so I have to think for myself.
+ Set myself a project (eg. Paper, Scissor, Stone). Research the modules etc I might need to do this.
+ Read about them.

etc etc, you get the picture. Eventually when I am confident enough I'll start looking over other people's code and improving it or bumming it down if possible.
And talking about that, bumming down code is a great way to become a better programmer. Set yourself targets. Write a program of say 100-300 lines and then say I'll remove 50-100 lines from this, but let it do the same thing.
I also like timed exercises such as make a script that shows the Fibonacci numbers up to n, which is a custom value - and do that in 2 minutes.

However, back to my original point - if you don't learn well like that then you're in a sticky situation. Learning from just doing projects right from day one is leading towards you becoming a bad programmer. But then again, if you learn from the textbook and never try a thing out, you won't be much better either (though your knowledge of the syntax will be better, your code will be inefficient and poorly thought out, most likely).

Take a look at this - something that is more likely to be written by a 100% project learnt coder:
Code: Select all
print "1";
print "2";
print "3";
print "4";
print "5";


Now take someone who is balanced:
Code: Select all
a = 1;
while a < 6:
     print a;
     a = a + 1;


See what I mean?
Now if you don't program like that you are most likely not 100% project learnt. After you have learnt the basics, your learning should almost totally be project based. But for the first few days to a week, it should be learning and doing the "hello world" type examples.
Image
User avatar
thedotmaster
Contributor
Contributor
 
Posts: 984
Joined: Sun May 04, 2008 4:39 pm
Location: North West UK
Blog: View Blog (1)


Re: New Python user

Post by SeachMall on Tue Sep 30, 2008 2:33 pm
([msg=12883]see Re: New Python user[/msg])

That example you gave gives me the impression you have no idea what I'm talking about, either I'm not explaining it well or your not picking it up. I'm not going to debate it, I completly agree that you need to read and learn but if you don't apply it you won't remember or you wont know how it works, I think you agree with that too. Now what I'm saying is instead of taking the examples from the book (which are usually random and have no 'universal' benefit, i.e. they don't make use of functions, variables etc.) you take what your reading about and try to apply it to achieve your goal, your project.

I don't know if that explains it better but its clear we have different opinions on it and we just seem to be going in circles.

G'day :ugeek:
Image
User avatar
SeachMall
New User
New User
 
Posts: 15
Joined: Wed Sep 17, 2008 5:11 pm
Location: Ireland
Blog: View Blog (0)


Re: New Python user

Post by thedotmaster on Tue Sep 30, 2008 3:02 pm
([msg=12886]see Re: New Python user[/msg])

I think finally we've come to a similar opinion. I think you were not explaining yourself well enough.
But I can tell you that I do know what I am doing, as a programmer of 5 years who has taught himself and been taught by a teacher - I have experience. But anyway, there's no point going around in circles when you're not listening.
Image
User avatar
thedotmaster
Contributor
Contributor
 
Posts: 984
Joined: Sun May 04, 2008 4:39 pm
Location: North West UK
Blog: View Blog (1)


Re: New Python user

Post by SeachMall on Tue Sep 30, 2008 3:20 pm
([msg=12889]see Re: New Python user[/msg])

thedotmaster wrote:But anyway, there's no point going around in circles when you're not listening.
We should all adhere to the opinions of the great Dot Master, all bow, all bow!

You've just said we agree but there was a break down in communitcation, and now this BS? Very arrogant today aren't we?
Image
User avatar
SeachMall
New User
New User
 
Posts: 15
Joined: Wed Sep 17, 2008 5:11 pm
Location: Ireland
Blog: View Blog (0)


Re: New Python user

Post by thedotmaster on Tue Sep 30, 2008 5:45 pm
([msg=12897]see Re: New Python user[/msg])

SeachMall wrote:
thedotmaster wrote:But anyway, there's no point going around in circles when you're not listening.
We should all adhere to the opinions of the great Dot Master, all bow, all bow!

You've just said we agree but there was a break down in communitcation, and now this BS? Very arrogant today aren't we?


One thing I'm not is arrogant. I like a good debate and if you prove me wrong then that's fine - but when I say something which you then ignore, that's quite annoying.
Anyway, no hard feelings. I think we were pretty much on the same wavelength.
Lock thread?
Image
User avatar
thedotmaster
Contributor
Contributor
 
Posts: 984
Joined: Sun May 04, 2008 4:39 pm
Location: North West UK
Blog: View Blog (1)


Re: New Python user

Post by liuyuan on Tue Sep 30, 2008 6:40 pm
([msg=12902]see Re: New Python user[/msg])

thedotmaster wrote:
SeachMall wrote:Bad analogy, not even comparable. How do you learn to add without doing a sum?


Code: Select all
print "1";
print "2";
print "3";
print "4";
print "5";


Now take someone who is balanced:
Code: Select all
a = 1;
while a < 6:
     print a;
     a = a + 1;




There're really not right way of doing this or wrong way of doing things... Only such things as "your way". I can complain about other people's code all day if i want to, but there's really no meaning in that.

Code: Select all
for i in range(5): print i+1;


gets you the same output... yet is a one liner... does that mean my code is better than yours? not really. It's just personal preferences after all. :>

I will not lock this thread yet, because some good quality material had came out of this. This isn't as much of a flame war, instead just programmers trying to protect their egos. Carry on :>
ImageImageImage
liuyuan
Experienced User
Experienced User
 
Posts: 64
Joined: Mon Apr 14, 2008 10:17 pm
Blog: View Blog (0)


Re: New Python user

Post by thedotmaster on Wed Oct 01, 2008 10:30 am
([msg=12940]see Re: New Python user[/msg])

I disagree.
Firstly that example was just a simple one, a better example would be something where multiple variables are used only once and a new variable is assigned, e.g:
Code: Select all
loop = 0
while a < 6:
     print "h";
     a = a + 1;
{more code}
loop2 = 0;
{loop}

etc.
A good way of programming is to try and reduce your code to as few lines as possible. Back in the days of LISP, assembly and before that - machine code - it was crucial to try and bum down your code as much as possible. Now, with the power of the systems we have today, it isn't - but that leads to poor programming technique among many many people.
Personally, I find bumming down my code fun. There is a certain thrill in reducing your code by 20 or 30 lines.
I appreciate what you say that it is personal preference, but I think you will agree that it is a better programming technique to use a loop in the first example? It saves time and makes the code more compact.
I also love the competitions where the winner completes a challenge in the fewest lines of code, with one instruction per line.
Image
User avatar
thedotmaster
Contributor
Contributor
 
Posts: 984
Joined: Sun May 04, 2008 4:39 pm
Location: North West UK
Blog: View Blog (1)


Re: New Python user

Post by SeachMall on Wed Oct 01, 2008 12:46 pm
([msg=12951]see Re: New Python user[/msg])

I like a good debate and if you prove me wrong then that's fine - but when I say something which you then ignore, that's quite annoying.
I'm not sure what I ignored.
Anyway, no hard feelings. I think we were pretty much on the same wavelength.
We're cool :)
A good way of programming is to try and reduce your code to as few lines as possible.
I agree, it makes maintaining and modifying code easier, having bloated code is just a pain in the ass.
Image
User avatar
SeachMall
New User
New User
 
Posts: 15
Joined: Wed Sep 17, 2008 5:11 pm
Location: Ireland
Blog: View Blog (0)


PreviousNext

Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests