The Secret Oasis
Would you like to react to this message? Create an account in a few clicks or log in to continue.


The new and improved The Secret Oasis! Here members can play games with each other and socialize.
 
HomeLatest imagesSearchRegisterLog in

 

 Programming 101.

Go down 
5 posters
AuthorMessage
Snoble




Posts : 41
Points : 49
Join date : 2010-09-04

Programming 101. Empty
PostSubject: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 9:02 am

Welcome, gents.

Note: This guide will be using alot, if not only, Python, an open-source coding language, as it is simple and minimalist. Since Python is very easy to read and understand, you probably won't need to know it, but I may or may not decide to teach it later.

=============
INTRODUCTION
=============

Programming is the art of handling data and making it do things, through code. Most people consider a "program" to have to interact with you to actually be a program.
Not true. A program could simply be a line of code that prints a single statement. Programs like this are trivial though - they accomplish nothing.

For example, in Python:

print("Hello, World!")

writes "Hello World" in an output window. This is a program, albeit a very simple one. It does only one thing - collects some data and prints it.

=================
BASIC DATA TYPES
=================

Before I get into data types, I will explain variables.
Variables are the key to programming. You use variables to store data in, and as the name suggests, they are variable.
Observe this line of code:

variable = "x"

I have stored the letter "x" in "variable".
Now, by doing something like this...

print (variable)

We can write out the contents of the variable, in this case, "x".

As you can see, variables are incredibly powerful, and they are what allow you to store and manipulate code. Another example:

a = 3
b = 2
print (a + b)

Writes out "5".

For a note on variables: "A" and "a" are NOT the same variable. They are two different things.

There are two basic data types that can be stored in variables. These are called "strings" and "integers". While there are other, more complex ones, these two are the absolute basic.
A string contains data in the form of text. For example:

string = "A String"

The variable "string" now contains "A String".

Integers are simply numbers.

integer = 9

But what if we did this...?

string = "9"
integer = 9
print (string + integer)

Well, I can tell you right now, it would generate an error. While YOU may see them as the same thing, the computer is just a bunch of circuits, and it sees one as text and one as a number. Keep this in mind - if you want to get user input and do math with it, you'll have to convert it to an integer first

So basically, keep in mind that strings and integers are two different things.

=============================================
WHAT PROGRAMMING LANGUAGE SHOULD I LEARN?
=============================================

There is no real answer to this question. At all.
Everyone you ask will have a different opinion, a different preference.
It all depends on what you want to do.
If you are truly interested in learning programming well, have a shot at C first. It will teach you VERY strict programming concepts, and when you've learnt or experienced the hardest, everything else is easy.
Ruby and Python may also be considerable, due to their simple syntax.
Other than that, it is really up to you. Do your research, and make your own decision.

======================================
CONTROL STRUCTURES IN PROGRAMMING
======================================

"Control Structures" refer to a way to make a program do different things based off of different results. They are IMPERATIVE to make programs work.

If you wish to just learn the theory behind this, just follow along. If you want to actually make the program, go to www.python.org and download Python 3.1.

The code

I'll just write the code, then explain it bit by bit at the end.

response = input("Enter your response: ")
if response == "yes":
print ("Response was 'Yes'")
elif response = "no":
print ("Response was 'No'")
else:
pass

Explaining.

response = input("Enter your response: ")

In Python, "input()" is a way to get user input. You fill the brackets with a string, prompting them. In this case, I have assigned whatever "input()" gets as a variable, "response".

The following block of code containing if, elif and else is what is known as an "if else" structure, the primary control structure in Python and the basic control structure in other languages.

If Else works like this:

If (condition):
(do this)

So, in this case, I've said that if "response" == "yes" (== means is equal too, = is used to assign variables) then to say the response was yes.
The works because if the person types in "yes", then it prints that line of code.

"Elif" is the exact same thing, but its simply used to set a second "if" in the same block. The reason for this is that we could get two "if" blocks executing at the same time if we used two "if"s.

Lastly, the "Else" statement catches anything else that was entered and simply does nothing, with the statement "pass".




Last edited by Snoble on Thu Sep 30, 2010 2:26 am; edited 3 times in total
Back to top Go down
Snoble




Posts : 41
Points : 49
Join date : 2010-09-04

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 9:03 am

Might reserve next post, in case it gets big D:
Back to top Go down
Mystyr Nile

Mystyr Nile


Posts : 174
Points : 200
Join date : 2010-09-18
Location : In this beautiful oasis with my friends.

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 9:34 am

HYESZ!
You used the "Hello World" program!
Back to top Go down
http://mystyrnile.webs.com
Jon

Jon


Posts : 77
Points : 100
Join date : 2010-09-04
Age : 30
Location : Lorida, Florida. (It's a real place. Google it)

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 11:59 am

lmao i was taking a programming class online
Back to top Go down
Ghosty
Admin
Ghosty


Posts : 222
Points : 282
Join date : 2010-09-04
Age : 29
Location : Florida

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 12:24 pm

Jon, learning to use microsoft office is not programming.
Back to top Go down
https://thesecretoasis.forummotion.com
Jon

Jon


Posts : 77
Points : 100
Join date : 2010-09-04
Age : 30
Location : Lorida, Florida. (It's a real place. Google it)

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 2:21 pm

Ghosty wrote:
Jon, learning to use microsoft office is not programming.

No no i was taking 2 online classes. one is the stupid microsoft shitbox
an the other was programming
Back to top Go down
Ghosty
Admin
Ghosty


Posts : 222
Points : 282
Join date : 2010-09-04
Age : 29
Location : Florida

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 2:34 pm

Jon wrote:
Ghosty wrote:
Jon, learning to use microsoft office is not programming.

No no i was taking 2 online classes. one is the stupid microsoft shitbox
an the other was programming
Oh I see.
Back to top Go down
https://thesecretoasis.forummotion.com
Ghosty
Admin
Ghosty


Posts : 222
Points : 282
Join date : 2010-09-04
Age : 29
Location : Florida

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeSat Sep 25, 2010 7:59 pm

Very good start, snobes.
Back to top Go down
https://thesecretoasis.forummotion.com
Matt

Matt


Posts : 21
Points : 25
Join date : 2010-09-18

Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitimeMon Sep 27, 2010 3:57 pm

BRILLIANT POST, SNOBLES!!!

Cool
Back to top Go down
Sponsored content





Programming 101. Empty
PostSubject: Re: Programming 101.   Programming 101. Icon_minitime

Back to top Go down
 
Programming 101.
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
The Secret Oasis :: Entertainment :: Computers-
Jump to: