Compile Crazy
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomePortalLatest imagesSearchRegisterLog in

 

 Variables in Python

Go down 
3 posters
AuthorMessage
Compu-Teck Inc.




Posts : 80
Join date : 2010-04-29
Age : 31

Variables in Python Empty
PostSubject: Variables in Python   Variables in Python I_icon_minitimeMon Aug 23, 2010 1:43 pm

Hey, all! It's Compu-Teck back with another Python Tutorial. This tutorial deals with variables (as seen in the title). I have decided to take a leaf out of ESS's book and explain a bit on how the program works. First, this is what it looks like:

Code:
i = 5
print i
i = i + 1
print i

output:

>>>
5
6


What makes this program work is first you are taking the variable "i" and assigning it the value of 5. Then, you are telling Python to print that value. Then, you are taking the variable "i" and adding one, then printing it. I will provide a more in-depth explanation on how this works in a much later tutorial.

You can also assign strings (words) to a variable. For example:

Code:
s = "This is a string!"
print s

Output:

This is a string!


What has happened here is first you are creating a variable simply names "s". Then, you are assigning the string "This is a string!" by putting an =. Don't forget the quotes around the string! Then, you are telling Python to display the value of "s" in the output area. After that, you are done!


Last edited by Compu-Teck Inc. on Thu Aug 26, 2010 8:57 am; edited 1 time in total
Back to top Go down
Excimer Sun Software

Excimer Sun Software


Posts : 152
Join date : 2010-05-07
Age : 31
Location : USA

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeTue Aug 24, 2010 10:18 pm

They say mockery is the sincerest form of flattery, and I'm flattered, CTI!Very Happy Good work!Smile
Back to top Go down
Compu-Teck Inc.




Posts : 80
Join date : 2010-04-29
Age : 31

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeWed Aug 25, 2010 8:53 am

Glad you approve, ESS!
Back to top Go down
gamerboy

gamerboy


Posts : 37
Join date : 2010-08-27
Age : 39
Location : Germany

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeFri Aug 27, 2010 5:00 pm

Shocked python looks related to another programming language, (yabasic) but its alot more powderful and faster than it (yabasic is for REALLY beginner programmers, but python has some advanced features.)
Back to top Go down
http://gamerboy8864hacks.freeforums.org
Excimer Sun Software

Excimer Sun Software


Posts : 152
Join date : 2010-05-07
Age : 31
Location : USA

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeSat Aug 28, 2010 9:26 am

Yes. This is part of why I like Python. It has a very gentle learning curve and is very readable, but is also very powerful and flexible language. In fact, a unique thing about Python is that it is a completely Object-Oriented language, but one doesn't have to use OOP in their programs unless they want to.Smile
Back to top Go down
Compu-Teck Inc.




Posts : 80
Join date : 2010-04-29
Age : 31

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeMon Aug 30, 2010 9:00 am

gamerboy wrote:
Shocked python looks related to another programming language, (yabasic) but its alot more powderful and faster than it (yabasic is for REALLY beginner programmers, but python has some advanced features.)

This is because Python is considered a mid-level programming language (I think).
Back to top Go down
Excimer Sun Software

Excimer Sun Software


Posts : 152
Join date : 2010-05-07
Age : 31
Location : USA

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeWed Sep 01, 2010 1:15 pm

It's a highly advanced programming language if you want it to be and know how to use it that way. Smile That's part of why I like it. It's great for beginners, but also powerful enough for advanced users as well.
Back to top Go down
Compu-Teck Inc.




Posts : 80
Join date : 2010-04-29
Age : 31

Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitimeFri Sep 03, 2010 8:54 am

Exactly...
Back to top Go down
Sponsored content





Variables in Python Empty
PostSubject: Re: Variables in Python   Variables in Python I_icon_minitime

Back to top Go down
 
Variables in Python
Back to top 
Page 1 of 1
 Similar topics
-
» What is python
» Basic OOP in Python
» Basic Python Scripting
» Python Import Easter Eggs

Permissions in this forum:You cannot reply to topics in this forum
Compile Crazy :: Programming :: Python :: For Beginners-
Jump to: