 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
luvaddict411 Advanced Cheater
Reputation: 0
Joined: 22 Nov 2007 Posts: 54
|
Posted: Fri Nov 23, 2007 9:55 am Post subject: tut for python? |
|
|
tell me?
_________________
Learning c# and java.
 |
|
| Back to top |
|
 |
avril18 Master Cheater
Reputation: 0
Joined: 11 Apr 2007 Posts: 380 Location: En san salvador, El Salvador
|
Posted: Fri Nov 23, 2007 10:04 am Post subject: |
|
|
read the sickies
_________________
|
|
| Back to top |
|
 |
raushan2007 Expert Cheater
Reputation: 0
Joined: 06 Nov 2007 Posts: 130
|
Posted: Fri Nov 23, 2007 10:59 am Post subject: |
|
|
Here you go but u need to download this programm to make it work.
Download link for the program:http://python.org/ftp/python/2.4.2/python-2.4.2.msi
Well, after reading some basic Python tutorials, I have enough knowledge for my first tutorial.
First of all, download Python 2.4. After downloading and installing, go to Start>>All Programs>>Python 2.4>>IDLE [Python GUI].
The new window that shows up is the window that our programs will be ran in. Click File>>New Window, and in this new window we will write our calculator code that I will explain it in a minute:
OP = raw_input('Operation: ')
First = raw_input('First number: ')
Second = raw_input('Second number: ')
if OP == "+":
Answer = int(First) + int(Second)
elif OP == "-":
Answer = int(First) - int(Second)
elif OP == "*":
Answer = int(First) * int(Second)
elif OP == "/":
Answer = int(First) / int(Second)
else:
print "Error"
print 'The answer is %s thank you for using! First Number: %s Second Number: %s Operator: %s' % (Answer, First, Second, OP)
Ok, the first part OP = raw_input('Operation: ') will assign the value someone types in to the variable OP so you can type +,-,* and / for the operator sign.
In the second part: First = raw_input('First number: ') and Second = raw_input('Second number: ')
This is the same as the first part, the only difference between the two are the variable names.
Third part:
if OP == "+":
Answer = int(First) + int(Second)
elif OP == "-":
Answer = int(First) - int(Second)
elif OP == "*":
Answer = int(First) * int(Second)
elif OP == "/":
Answer = int(First) / int(Second)
else:
print "Error"
print 'The answer is %s thank you for using! First Number: %s Second Number: %s Operator: %s' % (Answer, First, Second, OP)
First of all, it determines what the OP was. If the operator was *, then the answer variable would be int(First) * int(Second). Pretty easy as you can see. It's a common if statement. If the sign isn't any of the specified, the program will print an error.
Last Part:
print 'The answer is %s thank you for using! First Numer: %s Second Number: %s Operator: %s' % (Answer, First, Second, OP)
I know you might be a little confused, but it's quite simple. First of all it will print OP, Answer, First, and Second in the same string. However, notice the %s in the string all of those will be replaced by variables specified after the print command:
% (Answer, First, Second, OP)
which means the first instance of %s will be replaced by Answer the second instance will be replaced by First etc..
Go ahead and run the program. If all went well you should get results like this:
Operation: /
First number: 108
Second number: 9
The answer is 12 thank you for using! First number: 108 Second number: 9 Operator: /
>>>
Note it will show up in the Python GUI the first window that showed up when we started.
So wasn't that fun. Python is a harder language to use than VB, but it has some advantages to it like Regex and internet programming which I believe makes it much easier for lots of things.
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
|
| Back to top |
|
 |
SnipaReapa How do I cheat?
Reputation: 0
Joined: 24 Nov 2007 Posts: 7
|
Posted: Sat Nov 24, 2007 1:32 am Post subject: |
|
|
hot girl on the bottom avril
_________________
THE PWNAGE KING OF ALL GAMES! :/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|