-
42
pages
-
English
-
Documents
-
2011
Description
Python language: Data structuresand functionsThe FOSSEE GroupDepartment of Aerospace EngineeringIIT Bombay1 May, 2010Day 2, Session 2FOSSEE Team (IIT Bombay) Basic Python 1 / 40Outline1 Control flowBasic LoopingExercises2 Data structuresListsTuplesDictionariesSets3 FunctionsFOSSEE Team (IIT Bombay) Basic Python 2 / 40Control flowOutline1 Control flowBasic LoopingExercises2 Data structuresListsTuplesDictionariesSets3 FunctionsFOSSEE Team (IIT Bombay) Basic Python 3 / 40Control flow Basic LoopingOutline1 Control flowBasic LoopingExercises2 Data structuresListsTuplesDictionariesSets3 FunctionsFOSSEE Team (IIT Bombay) Basic Python 4 / 40Control flow Basic LoopingwhileExample: Fibonacci seriesSum of previous two elements defines the nextIn []: a, b = 0, 1In []: while b < 10:...: print b, a, b = b, a + b...:1 1 2 3 5 8FOSSEE Team (IIT Bombay) Basic Python 5 / 40Control flow Basic Loopingrange()range([start,] stop[, step])range() returns a list of integersThestart and thestep arguments are optionalstop is not included in the listDocumentation conventionAnything within[] is optionalNothing to do with Python.FOSSEE Team (IIT Bombay) Basic Python 6 / 40Control flow Basic Loopingfor . . .range()Example: print squares of first5 numbersIn []: for i in range(5):....: print i, i i*....:0 01 12 43 94 16FOSSEE Team (IIT Bombay) Basic Python 7 / 40Control flow Basic Loopingfor . . .range()Example: print squares of odd ...
-
Publié par
-
Publié le
27 juin 2011
-
Langue
English