Skip to Content
Automate the Boring Stuff with Python, 2nd Edition
book

Automate the Boring Stuff with Python, 2nd Edition

by Al Sweigart
November 2019
Beginner to intermediate
592 pages
14h 43m
English
No Starch Press
Content preview from Automate the Boring Stuff with Python, 2nd Edition

3FUNCTIONS

Image

You’re already familiar with the print(), input(), and len() functions from the previous chapters. Python provides several built-in functions like these, but you can also write your own functions. A function is like a miniprogram within a program.

To better understand how functions work, let’s create one. Enter this program into the file editor and save it as helloFunc.py:

def hello():      print('Howdy!')        print('Howdy!!!')        print('Hello there.') hello()    hello()    hello()

You can view the execution of this program at https://autbor.com/hellofunc/. The first line is a def statement , which defines a function named ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Automate the Boring Stuff with Python

Automate the Boring Stuff with Python

Al Sweigart

Publisher Resources

ISBN: 9781098122584Errata Page