Python 2.7 - Variables + Raw Inputs 07-16-2013, 02:35 AM
#1
First, some may automatically say this is from another forum. Well, I made it on that other forum, so I am not stealing anything! The other forum was called *Snip*, but I left. So there
.
I decided to make a simple and quick Python tutorial that will help you get started on your coding adventure.
What is Python?
Python, to me anyway, is a relatively easy-to-understand programming language, while remaining with smooth and powerful performance. It is highly recommended for beginners to learn this!
I am not really a coder myself, but if I need to make anything for my own benefit, I head straight to Python!
What are you going to learn?
First, I am going to throw an example of what you will be learning today out in the open:
Most people can easily read this. However, it is OK if you cannot! I will go over each thing that is used in this script.
The Print Function:
This command is the simplest line of code in all of humanity. It will print out a desired string of text.
Variables:
If you have been enrolled in a math class(Algebra 1 or higher), I hope you know what a variable is. However, I will say what it is anyway. A variable is basically a placeholder for a different value. These can be easily placed in python.
Raw Input:
If you can read simple code, this command is self explanatory. A raw input runs a string of text(or something else) to a user and lets the user respond. You can program how it responds using if statements. When you write out an if statement and you want it to do something based on an answer, you want to make sure you right it with two equal signs. Here is an example.
Ect. things shown in the tutorial:
I mentioned the if statement and else statement. The else statement runs a string of code if the answer is anything else than the if. Also, I showed a string of text called sys.exit(). This shuts down the program, but remember to put "import sys" at the beginning of the script! Example:
Thanks for reading! I know I quickly went over the if and else statement, but if you like the tutorial I will go over the if-then and else statements in full detail! Thanks!
Made by: Frost
Download Link to Python 2.7:
http://www.python.org/download/releases/2.7/
P.S: This tutorial is for Python 2.7. I have grown used to it, and the Python 3 syntax is different. Thanks.
.I decided to make a simple and quick Python tutorial that will help you get started on your coding adventure.
Frost's Beginner Python Tutorial!
What is Python?
Python, to me anyway, is a relatively easy-to-understand programming language, while remaining with smooth and powerful performance. It is highly recommended for beginners to learn this!
I am not really a coder myself, but if I need to make anything for my own benefit, I head straight to Python!
What are you going to learn?
First, I am going to throw an example of what you will be learning today out in the open:
![[Image: pah932ljk65rwmrz2gk.png]](http://hfimage.net/images/pah932ljk65rwmrz2gk.png)
Most people can easily read this. However, it is OK if you cannot! I will go over each thing that is used in this script.
The Print Function:
This command is the simplest line of code in all of humanity. It will print out a desired string of text.
Code:
print "Hello VIPHackforums!"Variables:
If you have been enrolled in a math class(Algebra 1 or higher), I hope you know what a variable is. However, I will say what it is anyway. A variable is basically a placeholder for a different value. These can be easily placed in python.
Code:
a = 'VipHackforums'Code:
b = '1337 Hacking Skills'![[Image: qifU53x.png]](http://i.imgur.com/qifU53x.png)
If you can read simple code, this command is self explanatory. A raw input runs a string of text(or something else) to a user and lets the user respond. You can program how it responds using if statements. When you write out an if statement and you want it to do something based on an answer, you want to make sure you right it with two equal signs. Here is an example.
Code:
a = raw_input("What is two plus two?: ")
if a == '4':
print 'Correct!'
else:
print 'Wrong!'Ect. things shown in the tutorial:
I mentioned the if statement and else statement. The else statement runs a string of code if the answer is anything else than the if. Also, I showed a string of text called sys.exit(). This shuts down the program, but remember to put "import sys" at the beginning of the script! Example:
Code:
import sys
sys.exit("This tutorial is over.")Thanks for reading! I know I quickly went over the if and else statement, but if you like the tutorial I will go over the if-then and else statements in full detail! Thanks!
Made by: Frost
Download Link to Python 2.7:
http://www.python.org/download/releases/2.7/
P.S: This tutorial is for Python 2.7. I have grown used to it, and the Python 3 syntax is different. Thanks.


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

.

