{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

t_11.4up

# t_11.4up - Whats in your toolbox Print statement string...

This preview shows pages 1–2. Sign up to view the full content.

Engineering Computation: Tutorial 11 Problem Solving with Computing, using the Python Language What’s in your toolbox? Print statement, string literals Basic calculator, integer division Variables Built-in functions Math library functions Straight-line programs Branching programs Python lists For loops Nested for loops Strings While loops Converting between number system using Python Matplotlib Program Design File Processing Graphics Functions Scope of Variables Comments Complex Conditions Testing and Debugging Exception Handling Common Loop Patterns Boolean Operators Unit Testing Classes and Objects Data Collections Searching and Sorting 2 Today’s Topics: 1 Recursion 3 Recall: Functions can call other functions. Let f 1 be the function that maps an integer n to the integer f 1 ( n ) = n 2 Let f 2 be the function that maps an integer n to the integer f 2 ( n ) = n i =0 f 1 ( i ) = f 1 (0) + · · · + f 1 ( n ) if n 0 0 if n < 0 f 1 implementation def fun1 (n ) : return n ** 2 *pyramid of golfballs f 2 implementation def fun2 (n ) :

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

t_11.4up - Whats in your toolbox Print statement string...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online