Tuesday, January 27, 2009

Lic Money Plus 180 Status



A variable is used to store a value of some sort. In python the following types of variables: (integer) · Numeric (floating) · Numerical (complex) · character string ·

Every variable before being called has to be assigned a value, otherwise it will error. print message

appears the error message is not defined, it does not contain any value.

In other programming languages \u200b\u200bc + +, java, vb variables are declared and then assigned the value. Python is not necessary to declare, but will assign a value to variable and from that moment, the variable is already part of the program.


What we need to take into account is that Python is case sensitive and sensitive.


Assign value to integer variables:


year = 2009





birth = 1986


Assign value to variables of type Floating


price = 10.93 salary = 560.33

Assign value to variables of type complex

>>> value = 5 * (4 + 2j) >>> print value

(20 +10 j) Assign value to variables of type string:

string of characters (can be enclosed in single or double quotes) message = "Welcome to InforNext" name = 'Perico'

Assign Boolean variables:

Visible = True

Code of Practice

print "Integer Variables"

year = 2009

birth = 1986

year print print birth

print "Variables of type float"

price = 10.93 = 560.33

salary

print print price paid

print "Variables of type complex" value

= 5 * (4 + 2j) print

value

print "string variables"

message = "Welcome to InforNext"

name = 'Perico'

print message print name

print "Boolean Variables"

visible = True print visible

raw_input ()





0 comments:

Post a Comment