Python Projects for Beginners a ten-Week Bootcamp Approach to Python Programming



Download 2,61 Mb.
bet78/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   74   75   76   77   78   79   80   81   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

CHAPTER 5
Functions
This week begins the topic of functions. Along with loops, functions can be one of the tougher topics to understand. For this reason, this entire week has been dedicated to covering functions only. This is also one of the more important topics in programming.
Knowing how to use a function will greatly improve your programming skills.
Functions give us the ability to make our programs much more powerful and clean while also saving us time. We’ll go over how they work on the first day, but the reason we use functions is because of the ability to write once and call repeatedly.
Many of the programs that we’ve already built can benefit from the use of functions, especially games like Hangman. At the end of the week, we’ll build a program that resembles a shopping cart list. We’ll see why it’s important to separate tasks such as adding, removing, and displaying into separate functions.
Overview

  • How to use functions and what they are

  • Passing data around using parameters

  • Returning data from functions

  • Understanding scope and its importance

  • Creating a shopping cart program

CHALLENGE QUESTION
Remember that an algorithm is nothing more than a set of step-by-step instructions. If we were to write an algorithm for changing a light bulb, what would it look like? What problems do you have to consider? How many steps are necessary? What is the most efficient method? Using the following algorithm, what problems may occur?
© Connor P. Milliken 2020
C. P. Milliken, Python Projects for Beginners, https://doi.org/10.1007/978-1-4842-5355-7_5

  1. Retrieve spare bulb.

  2. Turn off switch powering current bulb.

  3. Unscrew current bulb.

  4. Screw in spare bulb.

  5. Turn on switch powering new bulb.

  6. If spare bulb does not turn on, repeat steps 1 through 5.



Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   74   75   76   77   78   79   80   81   ...   200




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish