Python Essentials For Dummies by John C. Shovic & Alan Simpson
Author:John C. Shovic & Alan Simpson [Shovic, John C. & Simpson, Alan]
Language: eng
Format: epub
ISBN: 9781394263493
Publisher: Wiley
Published: 2024-04-01T00:00:00+00:00
Chapter 8
Wrangling Bigger Chunks of Code
IN THIS CHAPTER
Creating your own function
Including a comment in a function
Seeing how to pass information to a function
Returning values from a function
In this chapter, you learn how to better manage larger code projects by creating your own functions. Functions provide a way to compartmentalize your code into small tasks that can be called from multiple places in an app. For example, if something you need to access throughout the app requires a dozen lines of code, chances are you donât want to repeat that code over and over every time you need it. Doing so just makes the code larger than it needs to be. Also, if you want to change something, or if you have to fix an error in that code, you donât want to have to do it repeatedly in a bunch of different places. If all that code were contained in a function, you would have to change or fix it in only one location.
To access the task that the function performs, you call the function from your code, just as you call a built-in function such as print. In other words, you just type the name into your code. You can make up your own function names, too. So, think of functions as a way to personalize the Python language so that its commands fit what you need in your application.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12519)
Hello! Python by Anthony Briggs(9866)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9756)
The Mikado Method by Ola Ellnestam Daniel Brolund(9746)
Dependency Injection in .NET by Mark Seemann(9292)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8257)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7740)
Grails in Action by Glen Smith Peter Ledbrook(7666)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7515)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6739)
Microservices with Go by Alexander Shuiskov(6503)
Practical Design Patterns for Java Developers by Miroslav Wengner(6404)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6382)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6376)
Angular Projects - Third Edition by Aristeidis Bampakos(5759)
The Art of Crafting User Stories by The Art of Crafting User Stories(5292)
NetSuite for Consultants - Second Edition by Peter Ries(5236)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5052)
Kotlin in Action by Dmitry Jemerov(5017)
