<< 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

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
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?