0% found this document useful (0 votes)
43 views2 pages

Variables and Mathematical Operators

Uploaded by

medrek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Variables and Mathematical Operators

Uploaded by

medrek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

VARIABLES AND MATHEMATICAL OPERATORS

VARIABLES
Variables are assigned values.
A box filled with an object is a similar process.

MATHEMATICAL OPERATORS
Addition +
Subtraction -
Multiplication *
Power **
Division /
Floor Division //
Modulus %
Integer int(number)
Float float(number)

In [19]:

100 + 5
100 - 5
100 * 5
100 / 5

Out[19]:
20.0

In [89]:
print(4*4*4)
print(4**3)

64
64

In [3]:

box1 = 12
box2 = 100
box3

---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-7e7408937c3a> in <module>()
1 box1 = 12
2 box2 = 100
----> 3 box3

NameError: name 'box3' is not defined


NameError: name 'box3' is not defined

In [91]:
box3 = 300
box3
a, b, c = 20, 30, 40
a
b
c

num = a + b * c / 2
num
Out[91]:
620.0

In [82]:
x = 22 ; y = 32; z = 42.123456
x
y
z
type(z)
int(z)
type(int(z))

Out[82]:
int

In [77]:
var = 5
print(40/var)
print(40 //var)
print(40 % var)
print(40- (8*var))

8.0
8
0
0

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy