Compu-Teck Inc.
Posts : 80 Join date : 2010-04-29 Age : 31
| Subject: Variables in Python Mon 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 | |
|
Excimer Sun Software
Posts : 152 Join date : 2010-05-07 Age : 31 Location : USA
| Subject: Re: Variables in Python Tue Aug 24, 2010 10:18 pm | |
| They say mockery is the sincerest form of flattery, and I'm flattered, CTI! Good work! | |
|
Compu-Teck Inc.
Posts : 80 Join date : 2010-04-29 Age : 31
| Subject: Re: Variables in Python Wed Aug 25, 2010 8:53 am | |
| | |
|
gamerboy
Posts : 37 Join date : 2010-08-27 Age : 39 Location : Germany
| Subject: Re: Variables in Python Fri Aug 27, 2010 5:00 pm | |
| 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.) | |
|
Excimer Sun Software
Posts : 152 Join date : 2010-05-07 Age : 31 Location : USA
| Subject: Re: Variables in Python Sat 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. | |
|
Compu-Teck Inc.
Posts : 80 Join date : 2010-04-29 Age : 31
| Subject: Re: Variables in Python Mon Aug 30, 2010 9:00 am | |
| - gamerboy wrote:
- 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). | |
|
Excimer Sun Software
Posts : 152 Join date : 2010-05-07 Age : 31 Location : USA
| Subject: Re: Variables in Python Wed 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. That's part of why I like it. It's great for beginners, but also powerful enough for advanced users as well. | |
|
Compu-Teck Inc.
Posts : 80 Join date : 2010-04-29 Age : 31
| Subject: Re: Variables in Python Fri Sep 03, 2010 8:54 am | |
| | |
|
Sponsored content
| Subject: Re: Variables in Python | |
| |
|