<< Chapter < Page
  Itse 1359 introduction to     Page 2 / 7
Chapter >> Page >

You can later retrieve the values that you have stored there by referring to the pigeonhole by its nickname ( identifier ). You can also store a different value in the pigeonhole later if you desire.

The concept of type

Strongly typed languages

One of the main differences between Python and programming languages such as Java and C++ is the concept of type .

In strongly-typed languages like Java and C++, variables not only have a name, they also have a type. The type determines the kind of data that you can store in thepigeonhole.

It is probably more correct to say that the type determines the values that you can store there and the operations (addition, subtraction, etc.) that you can perform on those values.

Python is not strongly typed

One of the characteristics that makes Python easier to use than Java is the fact that with Python you don't have to be concerned about the type of avariable. Python takes care of type issues for you behind the scenes. However that ease of use comes with some costs attached.

Declaration of variables

Another difference between Python and Java is that with Java, you must declare variables before you can use them. Declaration of variables is not required with Python.

With Python, if you need a variable, you simply come up with a name and start using it as a variable.

Dangerous curves ahead !

With this convenience comes some danger. You can only have one variable with the same name within the same scope (I will discuss scope in a future module) .

Don't use the same name for two variables

With Python, if you unintentionally use the same name for two or more variables, the first will be overwritten by the second. This can lead to program bugs that aredifficult to find and fix.

A more subtle danger

A more subtle danger is that you create a variable that you intend to use more than once and you spell it incorrectly in one of those uses. This can be anextremely difficult problem to find and fix. I will illustrate what I mean by this later with a sample program.

Rules for identifiers

The name for a variable must follow the naming rules for identifiers that you will find in the Python Language Reference -- 2.3. Identifiers and keywords .

Give me the rules in plain English

The notation used in the Python Language Reference to define the naming rules is a little complicated, so I will try to interpret it for you.

Allowable characters

I believe that the Python Language Reference -- 2.3. Identifiers and keywords is saying that identifiers must begin with either a letter or an underscore character. Following that, you can use anunlimited sequence of letters (uppercase A through Z or lowercase a through z) , numbers (0 through 9) , or underscore characters.

Note that although the underscore character is allowed, it has special meaning in Python. I recommend that you do not use the underscorecharacter for the identifiers that you create.

Case is significant

The letters can be uppercase or lowercase, and case is significant. In other words, the identifier Ax is not the same as the identifier aX .

Questions & Answers

marginal cost formula
Nandu Reply
you should differentiate the total cost function in order to get marginal cost function then you can get marginal cost from it
What about total cost
formula of cross elasticity of demand
Theresia Reply
what is ceteris paribus
Priyanka Reply
what is ceteris parabus
Ceteris paribus - Literally, "other things being equal"; usually used in economics to indicate that all variables except the ones specified are assumed not to change.
What is broker
land is natural resources that is made by nature
What is broker
what is land
What is broker
land is natural resources that is made by nature
whats poppina nigga turn it up for a minute get it
amarsyaheed Reply
what is this?
am from nigeria@ pilo
am from nigeria@ pilo
what is production possibility frontier
it's a summary of opportunity cost depicted on a curve.
please help me solve this question with the aid of appropriate diagrams explain how each of the following changes will affect the market price and quantity of bread 1. A
Manuela Reply
please l need past question about economics
Prosper Reply
ok let me know some of the questions please.
ok am not wit some if den nw buh by tommorow I shall get Dem
Hi guys can I get Adam Smith's WEALTH OF NATIONS fo sale?
hello I'm Babaisa alhaji Mustapha. I'm studying Economics in the university of Maiduguri
my name is faisal Yahaya. i studied economics at Kaduna state university before proceeding to West African union university benin republic for masters
Hi guys..I am from Bangladesh..
Wat d meaning of management
igwe Reply
disaster management cycle
Gogul Reply
cooperate social responsibility
Fedric Wilson Taylor also define management as the act of knowing what to do and seeing that it is done in the best and cheapest way
difference between microeconomics and macroeconomic
Ugyen Reply
microeconomics is the study of individual units, firm and government while macroeconomics is the study of the economic aggregates.
The classical theory of full employment
what is monopoli power
Adzaho Reply
the situation that prevails when economic forces balance so that economic variables neither increase nor decrease
what is equilibrium
what are the important of economic to accounting students with references
salihu Reply
Economics is important because it helps people understand how a variety of factors work with and against each other to control how resources such as labor and capital get used, and how inflation, supply, demand, interest rates and other factors determine how much you pay for goods and services.
explain the steps taken by the government in developing rural market?
Azeem Reply
government provide good road for than
government should provide good agricultural project and it should also provide good road so that the the product that will come out of the farm will be easy transport to the market
farming equipments should be provided to farmers to help them improve in farming
improving the transport systems providing enterpreneur edecation to the mass living in rural zones enforcment of loans and capital for the people rising awareness on the advantages of rural areas
contribution of Adam smith in economics
abel Reply
I will join
I will join
I love this book and i need extra Economic book
what's happening here
I love this book and i need extra Economic book
what is the meaning of function in economics
Effah Reply
Pls, I need more explanation on price Elasticity of Supply
Isaac Reply
Is the degree to the degree of responsiveness of a change in quantity supplied of goods to a change in price
what is production
Okay what is land mobile and land unmobile
And what are the resources in land
the proces of using the services of labor and equipmnt together with other in puts to make goods and services availble
Okay what is land mobile and land unmobile
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Itse 1359 introduction to scripting languages: python. OpenStax CNX. Jan 22, 2016 Download for free at https://legacy.cnx.org/content/col11713/1.32
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Itse 1359 introduction to scripting languages: python' conversation and receive update notifications?