Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 2

Doc print print each case the result the value the variable

2.3 Variable names and keywords 13
message

"What’s up, Doc?"

n
pi

>>> print n
17
>>> print pi
3.14159

In each case the result is the value of the variable. Variables also have types; again, we can ask the interpreter what they are.

Variable names can be arbitrarily long. They can contain both letters and num-bers, but they have to begin with a letter. Although it is legal to use uppercase letters, by convention we don’t. If you do, remember that case matters. Bruce and bruce are different variables.

The underscore character ( ) can appear in a name. It is often used in names with multiple words, such as my name or price of tea in china.

14 Variables, expressions and statements

Python has twenty-eight keywords:

and

continue

import
raise
assert

except

from

return
break
global

is

pass

try
class
finally
lambda print while

A statement is an instruction that the Python interpreter can execute. We have seen two kinds of statements: print and assignment.

When you type a statement on the command line, Python executes it and displays the result, if there is one. The result of a print statement is a value. Assignment statements don’t produce a result.

1
2

Again, the assignment statement produces no output.

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELI05D167F
img
Uploaded by :
PbPlL1AX
Page 1 Preview
doc print print each case the result the value the
Sell Your Old Documents & Earn Wallet Balance