![]() |
|
Python 2.7 - Variables + Raw Inputs - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Python (https://sinister.li/Forum-Python) +--- Thread: Python 2.7 - Variables + Raw Inputs (/Thread-Python-2-7-Variables-Raw-Inputs) Pages:
1
2
|
Python 2.7 - Variables + Raw Inputs - Frost_mybb_import12855 - 07-16-2013 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. 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: ![]() 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'![]() 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. RE: Python 2.7 - Variables + Raw Inputs - Linuxephus™ - 07-16-2013 Mentioning of another hack related forum removed. RE: Python 2.7 - Variables + Raw Inputs - Linuxephus™ - 07-16-2013 Mentioning of another hack related forum removed. RE: Python 2.7 - Variables + Raw Inputs - Frost_mybb_import12855 - 07-16-2013 (07-16-2013, 02:39 AM)Linuxephus™ Wrote: Mentioning of another hack related forum removed. Sorry about that, I was just worried and I didn't want to cause confusion. I don't want to get a bad start on this forum .
RE: Python 2.7 - Variables + Raw Inputs - Frost_mybb_import12855 - 07-16-2013 (07-16-2013, 02:39 AM)Linuxephus™ Wrote: Mentioning of another hack related forum removed. Sorry about that, I was just worried and I didn't want to cause confusion. I don't want to get a bad start on this forum .
RE: Python 2.7 - Variables + Raw Inputs - Linuxephus™ - 07-16-2013 (07-16-2013, 02:42 AM)Frost Wrote:(07-16-2013, 02:39 AM)Linuxephus™ Wrote: Mentioning of another hack related forum removed. No worries mate. RE: Python 2.7 - Variables + Raw Inputs - Linuxephus™ - 07-16-2013 (07-16-2013, 02:42 AM)Frost Wrote:(07-16-2013, 02:39 AM)Linuxephus™ Wrote: Mentioning of another hack related forum removed. No worries mate. RE: Python 2.7 - Variables + Raw Inputs - redN00ws - 07-16-2013 Good basic explanation for Python beginners. Great job, Frost. :ok: RE: Python 2.7 - Variables + Raw Inputs - redN00ws - 07-16-2013 Good basic explanation for Python beginners. Great job, Frost. :ok: RE: Python 2.7 - Variables + Raw Inputs - Ex094 - 07-16-2013 Not a Well Explained tutorial but Good Job |