Login Register


Python/programming introduction filter_list
Author
Message
Python/programming introduction #1
I'd like to start out this thread with a few simplicities if you will.

Firstly, you may have been told constantly "go with this language, go with that language" and so on.

But let me point some thing out, most languages are really the same.

(NOTE: I said most.)
They usually have their if, and else statements.
And they have their own version of print.

An example would be as follows. Java
Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

And Python
Code:
print("Hello World!")

Granted with a language like java you must learn extra "rules" as I'll call them.

But what I'm getting at is if you learn a language basics, and learn it's rules and so forth, then you can apply that knowledge to almost any language, as long as you have the API.

For your reference I'll post the API, for python.

http://docs.python.org/3/library/

Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

In most languages (maybe all because I'm not that experienced yet.)
You just indent your line of code if it works with another line (an example will be shown later on.)

Now my tools as a programmer. http://www.emeraldeditor.com/

http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.


http://www.python.org/download/releases/3.3.0/ just scroll down and get the proper one for your computer.

Now emerald editor comes with it's own instruction documents for setting up java, so I won't go further into that.

but for python we go into: tools --> preferences --> user tools
Then click on a sign that says empty, and on menu text just type whatever you want to go there.
On command C:\Python33\pythonw.exe (although just click the button next to command, because your python file might not be where mine landed, so instead of getting frustrated just search yourself)
argument $(FileName)
initial dir $(FileDir)
hot key whatever key you want.
make sure capture output, and save before execute are check marked. and leave the rest blank.

SO once that's out of the way let's go ahead and do a bit more advanced programming.

Code:
#bazinga is our "variable" we have it defined, using the = sign. int declares what type of number we are using. #which by using int it would be any "real number" (if I remember math class correctly) #example being 1, 2, 3, 4,. #But there's float which would be say 1.01 and so on. #Now input means the Variable equals what the user inputs into the command. #and the words surrounded by quotes and parentheses is just basically the instruction to the user, telling them what to do next. bazinga = int (input("Pick a number any number.")) #this is an "if statement" it tells the computer if bazinga (which is the number you input) is greater than or equal # to 3 then print bingo if bazinga >= 3: print ("Bingo!") #The else statement is saying if the above is false, and the number is less than 3 then print "Try again" else: print ("Try again")

Now that's that for the tutorial (so far)
I plan on adding on to it, and making it bigger and better.
And even formatting it.
[Image: HJIAwEw.png]

Reply

Python/programming introduction #2
I'd like to start out this thread with a few simplicities if you will.

Firstly, you may have been told constantly "go with this language, go with that language" and so on.

But let me point some thing out, most languages are really the same.

(NOTE: I said most.)
They usually have their if, and else statements.
And they have their own version of print.

An example would be as follows. Java
Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

And Python
Code:
print("Hello World!")

Granted with a language like java you must learn extra "rules" as I'll call them.

But what I'm getting at is if you learn a language basics, and learn it's rules and so forth, then you can apply that knowledge to almost any language, as long as you have the API.

For your reference I'll post the API, for python.

http://docs.python.org/3/library/

Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

In most languages (maybe all because I'm not that experienced yet.)
You just indent your line of code if it works with another line (an example will be shown later on.)

Now my tools as a programmer. http://www.emeraldeditor.com/

http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.


http://www.python.org/download/releases/3.3.0/ just scroll down and get the proper one for your computer.

Now emerald editor comes with it's own instruction documents for setting up java, so I won't go further into that.

but for python we go into: tools --> preferences --> user tools
Then click on a sign that says empty, and on menu text just type whatever you want to go there.
On command C:\Python33\pythonw.exe (although just click the button next to command, because your python file might not be where mine landed, so instead of getting frustrated just search yourself)
argument $(FileName)
initial dir $(FileDir)
hot key whatever key you want.
make sure capture output, and save before execute are check marked. and leave the rest blank.

SO once that's out of the way let's go ahead and do a bit more advanced programming.

Code:
#bazinga is our "variable" we have it defined, using the = sign. int declares what type of number we are using. #which by using int it would be any "real number" (if I remember math class correctly) #example being 1, 2, 3, 4,. #But there's float which would be say 1.01 and so on. #Now input means the Variable equals what the user inputs into the command. #and the words surrounded by quotes and parentheses is just basically the instruction to the user, telling them what to do next. bazinga = int (input("Pick a number any number.")) #this is an "if statement" it tells the computer if bazinga (which is the number you input) is greater than or equal # to 3 then print bingo if bazinga >= 3: print ("Bingo!") #The else statement is saying if the above is false, and the number is less than 3 then print "Try again" else: print ("Try again")

Now that's that for the tutorial (so far)
I plan on adding on to it, and making it bigger and better.
And even formatting it.
[Image: HJIAwEw.png]

Reply

Python/programming introduction #3
I'd like to start out this thread with a few simplicities if you will.

Firstly, you may have been told constantly "go with this language, go with that language" and so on.

But let me point some thing out, most languages are really the same.

(NOTE: I said most.)
They usually have their if, and else statements.
And they have their own version of print.

An example would be as follows. Java
Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

And Python
Code:
print("Hello World!")

Granted with a language like java you must learn extra "rules" as I'll call them.

But what I'm getting at is if you learn a language basics, and learn it's rules and so forth, then you can apply that knowledge to almost any language, as long as you have the API.

For your reference I'll post the API, for python.

http://docs.python.org/3/library/

Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

In most languages (maybe all because I'm not that experienced yet.)
You just indent your line of code if it works with another line (an example will be shown later on.)

Now my tools as a programmer. http://www.emeraldeditor.com/

http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.


http://www.python.org/download/releases/3.3.0/ just scroll down and get the proper one for your computer.

Now emerald editor comes with it's own instruction documents for setting up java, so I won't go further into that.

but for python we go into: tools --> preferences --> user tools
Then click on a sign that says empty, and on menu text just type whatever you want to go there.
On command C:\Python33\pythonw.exe (although just click the button next to command, because your python file might not be where mine landed, so instead of getting frustrated just search yourself)
argument $(FileName)
initial dir $(FileDir)
hot key whatever key you want.
make sure capture output, and save before execute are check marked. and leave the rest blank.

SO once that's out of the way let's go ahead and do a bit more advanced programming.

Code:
#bazinga is our "variable" we have it defined, using the = sign. int declares what type of number we are using. #which by using int it would be any "real number" (if I remember math class correctly) #example being 1, 2, 3, 4,. #But there's float which would be say 1.01 and so on. #Now input means the Variable equals what the user inputs into the command. #and the words surrounded by quotes and parentheses is just basically the instruction to the user, telling them what to do next. bazinga = int (input("Pick a number any number.")) #this is an "if statement" it tells the computer if bazinga (which is the number you input) is greater than or equal # to 3 then print bingo if bazinga >= 3: print ("Bingo!") #The else statement is saying if the above is false, and the number is less than 3 then print "Try again" else: print ("Try again")

Now that's that for the tutorial (so far)
I plan on adding on to it, and making it bigger and better.
And even formatting it.
[Image: HJIAwEw.png]

Reply

RE: Python/programming introduction #4
Ah, nice. A general programming tutorial.
It really needs some formatting, but you already said you still work on it.

Some comments about Java:

Quote:http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.

JRE is already included in JDK, so you only need the JDK in order to develop and run Java programs.

Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

The Java code conventions require you to start class names with an uppercase letter.

Quote:Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

I wouldn't say sadly as it has some advantages. It means you don't have to type brackets or similar to define a block in the language. That makes Python more concise and it looks somewhat cleaner.

However, I prefer brackets over indentation too.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: Python/programming introduction #5
Ah, nice. A general programming tutorial.
It really needs some formatting, but you already said you still work on it.

Some comments about Java:

Quote:http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.

JRE is already included in JDK, so you only need the JDK in order to develop and run Java programs.

Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

The Java code conventions require you to start class names with an uppercase letter.

Quote:Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

I wouldn't say sadly as it has some advantages. It means you don't have to type brackets or similar to define a block in the language. That makes Python more concise and it looks somewhat cleaner.

However, I prefer brackets over indentation too.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: Python/programming introduction #6
Ah, nice. A general programming tutorial.
It really needs some formatting, but you already said you still work on it.

Some comments about Java:

Quote:http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.

JRE is already included in JDK, so you only need the JDK in order to develop and run Java programs.

Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

The Java code conventions require you to start class names with an uppercase letter.

Quote:Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

I wouldn't say sadly as it has some advantages. It means you don't have to type brackets or similar to define a block in the language. That makes Python more concise and it looks somewhat cleaner.

However, I prefer brackets over indentation too.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: Python/programming introduction #7
(02-11-2013, 12:19 PM)Deque Wrote: Ah, nice. A general programming tutorial.
It really needs some formatting, but you already said you still work on it.

Some comments about Java:

Quote:http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.

JRE is already included in JDK, so you only need the JDK in order to develop and run Java programs.

Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

The Java code conventions require you to start class names with an uppercase letter.

Quote:Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

I wouldn't say sadly as it has some advantages. It means you don't have to type brackets or similar to define a block in the language. That makes Python more concise and it looks somewhat cleaner.

However, I prefer brackets over indentation too.


Well I honestly prefer indentation, I just put it that way, because from the programmers I talked to, they mostly despise indentation.

And yes, this will probably be a tutorial that lasts as long as I stay with hackcommunity, and anybody is welcomed to add their own input.

But I'd like to make one point as to why I'm using python as an example in most things, it's because it's a language very similar to the fake language psuedocode.
SO it's more or less easier to take what python teaches you, and transfer it to another language.
[Image: HJIAwEw.png]

Reply

RE: Python/programming introduction #8
(02-11-2013, 12:19 PM)Deque Wrote: Ah, nice. A general programming tutorial.
It really needs some formatting, but you already said you still work on it.

Some comments about Java:

Quote:http://www.oracle.com/technetwork/java/j...index.html just get both the jdk and jre from there.

JRE is already included in JDK, so you only need the JDK in order to develop and run Java programs.

Code:
public class javatest{ public static void main (String[] args){ System.out.println("Hello World"); } }

The Java code conventions require you to start class names with an uppercase letter.

Quote:Now another thing you need to take note of, some languages require indentation.
Whereas some do not.
Sadly python is one language that requires it.

But indentation isn't so bad once you get used to it.

I wouldn't say sadly as it has some advantages. It means you don't have to type brackets or similar to define a block in the language. That makes Python more concise and it looks somewhat cleaner.

However, I prefer brackets over indentation too.


Well I honestly prefer indentation, I just put it that way, because from the programmers I talked to, they mostly despise indentation.

And yes, this will probably be a tutorial that lasts as long as I stay with hackcommunity, and anybody is welcomed to add their own input.

But I'd like to make one point as to why I'm using python as an example in most things, it's because it's a language very similar to the fake language psuedocode.
SO it's more or less easier to take what python teaches you, and transfer it to another language.
[Image: HJIAwEw.png]

Reply

RE: Python/programming introduction #9
nice introduction mate , not read all content but starting something on languages need i think as like this one
[Image: Wfxdx.png]

Reply

RE: Python/programming introduction #10
nice introduction mate , not read all content but starting something on languages need i think as like this one
[Image: Wfxdx.png]

Reply







Users browsing this thread: