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



Download 2,61 Mb.
bet91/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   87   88   89   90   91   92   93   94   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

Challenge Question Solution
The purpose of this challenge was to make you start thinking about possible errors in the steps laid out. Before you start programming the algorithm, you need to understand what could go wrong with the steps you’ve designed because computers are only as smart as you program them to be. There are several problems with this algorithm. Most notably between steps 2 and 3, where we try to replace the bulb. Did you check to see if the bulb was too hot to touch? In this case we did not, so anybody following this algorithm directly could get burned. As humans, basic instincts take over, and we would stop touching it, but computers will continue to perform the task they’re told. Other glaring problems would include checking the replacement bulb being the correct type, and what to do with the bulb that we just replaced. The algorithm doesn’t specify a step to dispose of it properly, so do we just leave it in our hand forever? These are steps we need to consider when replacing a bulb. When you begin to build your own algorithms, you need to not only make sure the algorithm works but that you’ve thought of how to handle error-prone situations.
Weekly Challenges
To test out your skills, try these challenges:

  1. Refactor Hangman: This is a large task, so tread lightly, but try to refactor the Hangman project from last week to use functions. Think about what actions Hangman requires, and turn those tasks into functions.

  2. Removing by Index: In the shopping cart program, set up the remove function so that you can remove via the index as well. Set the list up so that it prints out as a numbered list, and when asked to remove an item, the user can also type out a number next to the list item. For example, using the following you can type “1” to remove “Grapes”:

>>> 1) Grapes
>>> What would you like to remove? 1
CHAPTER 6
Data Collections and Files
There are several data stuctures in Python. We’ll cover dictionaries, sets, tuples, and frozensets this week to add to our knowledge of collections. Each one has a specific purpose as we’ll see the differences between each.
Knowing how to work with files in any language is important. In order to work with data, we’ll need to know how to read and write from several types of files. We’ll cover how to work with text files and CSV files.
Overview

  • Understanding dictionaries

  • Working with dictionaries

  • Learning other important data collections

  • Working with files

  • Creating a sample database with files


Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   87   88   89   90   91   92   93   94   ...   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