Alright, so you came here for either two things; A) Your looking to become a programmer, or Your taking some unwanted programming classes and you need to learn something quick. Either way, I am going to show you the basic fundamentals between some different programming languages and how they work. So, in a way this would be your basic introduction to programming theory as well. I am sure you have spent a lot of time trying to read guides and coding books that didn't work out as planned. Maybe every time you got a book you would get sick of reading it and you started to think, "I'll never learn to code", or maybe you have motivation but you just don't understand any of that "gibberish" that is described in those books. Well, I am here to kind of clear that up for you and make it easier for you to understand the basics so you can attempt to read from more advanced books. Now, that we have that out of the way, lets continue on to what you need.
[Requirements & Recommendations]
- A Programming Compiler (C++, Python, Visual Basic, etc)
- Read this guide carefully. Read it again if you don't understand it.
- Have a reference guide when coding, like a programming book of your choice.
- Visit some if not all of the links that I have posted in this guide.
If you do not like reading, you should stop now or just grind through it because their is a lot of reading associated with this guide. I have always said, "Failure's do not become successor's because they do not apply the tools around them. - Donovan Simon". Let's move on to the contents of this guide.
Folder: Become a Programmer
- Linux Related
This folder has a lot of information about Unix and Linux. If you are interested in either of them, then you should start their. These are some good things to know when wanting to become a programmer.
- HTML Related
This folder has a few topics about HTML. I have not read this folder yet but, I know they have some good free tutorials and some information that could be useful for HTML beginners.
- Software Related
This is just about software. The only guide in it at the moment is, "Software Releases". It explains what you should do when you release new software and what you should think about when releasing new patches or versions for that software.
- Cultural and Informational
This folder has some information about the programming community. Some terms that you will find a lot of programmers use and things that the programming community like and dislike. This is what motivated me in becoming a programmer and I think it will help you as well. I recommend you read everything in this folder. Once you do you will have some information about the programing culture and community. You might even gain some more respect from people around the community for taking the time out to read into it and know more about it. Knowing programming is one thing but, knowing how it work, where it came from, and the history is really good to know.
- Learning to Program
This folder has a web page that talks all about programming. The Python documentation is there for you to read all about python. Please Note: Some of the contents may not be fully published.
Lets start off with simple calculations. If you would like you can open python 2.6 and begin. If you learn these three things you should be able to open Python and begin basic coding without any worries or confusion. You might not be able to code your program to do everything you want it to do but, you will be able to do some basic stuff.
- Defining a Variable
Health = 100 Ring = health + 5 print "Welcome to 'THE GAME' your health is", HealthIf you loaded that script in the Python 2.6 console, it would look something like this;
[COLOR=Black] Welcome to 'THE GAME' your health is 100 >>> [/COLOR]
The chevron (>>>) symbol indicates that you are at the end of scripts simulations. You can make continuous loops, or menus that do not end a game unless otherwise authorized by the user as well. So, those are the basics to defining a variable. Variables are used in games to define how many bag slots are left, what time it is on the game, and various other things.
This is where you learn how to implement the action or interacting parts of your program. This is key when making a game, the more interaction the user has with the game the more entertainment he or she will have while playing. In this example we ask the user a question and store the users input in a data stream known as raw_input.
Health = 100 Ring = health + 5 print "Welcome to 'THE GAME' your health is", Health Name = raw_input("\nWhat is your name?: ") print "\nNice to meet you", Name
With that out of the way, lets continue to another example below.
Balance = 1000 print "Welcome to 'The Bank System' you balance is", Balance Withdraw = input("Withdraw Amount: ") Balance -= Withdraw print "\nYour current balance is now: $", Balance Withdraw = input("Withdraw Amount: ") Balance -= Withdraw
[If & Else Statements]
Here is an example of the If and Else statement, the If and Else statements can be used for allowing multiple decisions or actions to be made, checking, sending, or receiving information, and plenty of other useful tasks. Here is an example of these very statements at work.
Balance = 1000 Withdraw = 0 print "Welcome to 'The Bank System' you balance is", Balance Withdraw = input("Withdraw Amount: ") if Balance == 0: print "\nYour out of money!" if Withdraw > Balance: print "\nYou do not have that much!" Withdraw = input("Withdraw Amount: ") Balance -= Withdraw print "\nYour current balance is now,", Balance
Well, thank you for taking the time out to read my programming guide but, most of all you should be thanking yourself for taking that first step. I have provided some extra resources and information below that can further assist you with anything you may need as a beginner.
[B][CODING TIPS] [/B] Name Spaces: Name spaces or line spaces are often used to create a new line within code. In order to do this, simply add, "\n" right before the sentence you want to be on the next line. Printing Messages: Printing message or sending output to the user is also simple. Just use this code, "print "My Message!" Displaying Variables in Messages: Displaying or defining variables in messages is also quite simple, just experiment with the example code below and you will get the hang of it. Example 1: print "Welcome to the bank, your balance is: ", pBalance Example 2: print "Welcome ", pName ", to Cosco." Example 3: print "Welcome ", pName sName = Cosco ", to ", sName "." These are just a few examples on how this works. [COLOR=Black][SIZE=2]Variable1 > Variable2: If Variable1 is greater than Variable2 I.E: Quarter > Dime [/SIZE][/COLOR] [SIZE=2][COLOR=Black]Variable1 -= Variable2: I do not know how to make this into a definition but, this will make it so you do not have to add another Variable2 and rename it to variable3 when doing a calculation. Like shown above.[/COLOR][/SIZE] [SIZE=2][COLOR=Black] Variable1 = Value: Defines the value of a variable. I.E: Variable1 = 1[/COLOR][/SIZE] [SIZE=2][COLOR=Black] Variable1 = Variable2 - Variable3: [/COLOR][/SIZE][SIZE=2][COLOR=Black]A variable that is equal to a negative variable equation.[/COLOR][/SIZE][SIZE=2][COLOR=Black] I.E: Broke = Person - Money Variable1 = Variable2 + Variable3: A variable that is equal to an additional variable equation.[/COLOR][/SIZE] I.E: Rich = Person + Money Remember: code is case sensitive, so if anything does not match you will have errors in your code.
[Downloads and Resources]
• Gzipped source tar ball (2.6) (sig)
• Bzipped source tar ball (2.6) (sig)
• Windows x86 MSI Installer (2.6) (sig)
• Windows AMD64 MSI Installer (2.6) (sig)
• Max Installer disc image (2.6) (sig)
Excellent Python Guide: Here
Edited by Roger, 28 May 2011 - 02:20 PM.