Python language: Basics (session 7)
38 Pages
English

Python language: Basics (session 7)

-

Downloading requires you to have access to the YouScribe library
Learn all about the services we offer

Description

Python language: BasicsThe FOSSEE GroupDepartment of Aerospace EngineeringIIT BombaySciPy 2010, Introductory tutorialsDay 2, Session 1FOSSEE Team (IIT Bombay) Basic Python 1 / 36Outline1 Data typesNumbersBooleansStrings2 Operators3 Simple IO4 Control flowBasic Conditional flowFOSSEE Team (IIT Bombay) Basic Python 2 / 36Data typesOutline1 Data typesNumbersBooleansStrings2 Operators3 Simple IO4 Control flowBasic Conditional flowFOSSEE Team (IIT Bombay) Basic Python 3 / 36Data typesPrimitive Data typesNumbers: float, int, complexStringsBooleansFOSSEE Team (IIT Bombay) Basic Python 4 / 36Data types NumbersOutline1 Data typesNumbersBooleansStrings2 Operators3 Simple IO4 Control flowBasic Conditional flowFOSSEE Team (IIT Bombay) Basic Python 5 / 36Data types NumbersNumbersintwhole number, no matter what the size!In []: a = 13In []: b = 99999999999999999999floatIn []: p = 3.141592FOSSEE Team (IIT Bombay) Basic Python 6 / 36Data types NumbersComplex numbersIn []: c = 3+4jIn []: abs(c)Out[]: 5.0In []: c.imagOut[]: 4.0In []: c.realOut[]: 3.0FOSSEE Team (IIT Bombay) Basic Python 7 / 36Data types BooleansOutline1 Data typesNumbersBooleansStrings2 Operators3 Simple IO4 Control flowBasic Conditional flowFOSSEE Team (IIT Bombay) Basic Python 8 / 36Data types BooleansBooleansIn []: t = TrueIn []: F = not tIn []: F or tOut[]: TrueIn []: F and tOut[]: False5 mFOSSEE Team (IIT Bombay) Basic Python 9 / 36Data types ...

Informations

Published by
Published 27 June 2011
Reads 0
Language English
OFSSEETeam(II
Python language: Basics
TB
The FOSSEE Group
Department of Aerospace Engineering IIT Bombay
SciPy 2010, Introductory tutorials Day 2, Session 1
moab)yaBsicPython1/36
Outline
1
2
3
4
OF
Data types Numbers Booleans Strings
Operators
Simple IO
Control flow Basic Conditional
SSEEeTmaI(ITBombay)
flow
BasicPython2/63
1
2
Operators
3
6
Outline
Data types Numbers Booleans Strings
Simple IO
4
Control flow Basic Conditional
flow
aDatepytsOSFn3/3ythosicPy)BamoabIIBTae(mESTE
Datatypestpyse
Booleans
Strings
Numbers:
Primitive Data
63/4nohtyPc
complex
float,
int,
TEaeSOESFBasibay)TBomm(II
EEeTOFSS
2
Operators
3
Simple IO
4
Control flow Basic Conditional
flow
yPcinoht63/5
1
Data types Numbers Booleans Strings
Outline
(IamBoITaymbas)BsNumbersDatatype
3.141592
float
In []:
p
=
eTmaI(TIOFSSEEicasthPymbBo)Bay
In []:
a
=
13
In []:
b
=
99999999999999999999
/6no
int whole number, no matter what the size!
63ersNumbebsrNsmuytepaDat
c.real 3.0
In []: Out[]:
c.imag 4.0
In []: Out[]:
6/3
In []: Out[]:
abs(c) 5.0
c = 3+4j
In []:
ytcPn7hoFaeTEESSOomTBIIm(siBay)baaDatytepNsmuebrsComplexnumbers
snaelooBsepytaatD8/onthPy
2
Operators
Data types Numbers Booleans Strings
1
Outline
36bmoBTII(cisaB)ya
flow
Simple IO
3
Control flow Basic Conditional
4
FOSSEETeam
ESSOaeTEFsanleoosBpetytaaD
t
Fand False
In []: Out[]:
Fort True
In []: Out[]:
In
[]:
F
True
=
t
[]:
In
5 m
BTmo(mIIaBisab)yhon9cPyt
Booleans
t
not
=
/36
enceecedorprs()fnaelooBsepytataD
orc)
10 m
In []: In []: In []:
a = False b = True c = True
(aandb) True
In []: Out[]:
In []: Out[]:
aand(b False
htnociyP6
or
c
013/BoIT(Iamas)BaymbeTEESSOF
11/36
Outline
Data types Numbers Booleans Strings
icPythonbmyaB)samaI(TIoB
3
Operators
2
1
flow
Control flow Basic Conditional
4
Simple IO
aDatytepSsrtnisgeTEESSOF