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



Download 2,61 Mb.
bet157/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   153   154   155   156   157   158   159   160   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

TUESDAY EXERCISES


  1. User Input: Create a decorator that will ask the user for a number, and run the function it is attached to only if the number is less than 100. the function should simply output “Less than 100”. Use the function declaration in the

following:
>>> @decorator >>> def numbers( ):
>>> print("Less than 100")

  1. Creating a Route: Create a decorator that takes in a string as an argument with a wrap function that takes in func. have the wrap function print out the string, and run the function passed in. the function passed in doesn’t need to do anything. in Flask, you can create a page by using decorators that accept a Url string. Use the function declaration in the following to start:

>>> @route("/index") >>> def index( ):
>>> print("This is how web pages are made in Flask")

today was an important lesson in preparation for other technologies that use python, such as frameworks. decorators help to improve function execution and can be attached to any function necessary. this helps to reduce code and give improved functionality.
Wednesday: Modules
Most programs tend to include so many lines of code that you wouldn’t store it all within a single file. Instead you separate the code into several files, which helps to keep the project organized. Each one of these files is known as modules. Within these modules are variables, functions, classes, etc., that you can import into a project. Luckily, Python has a large following of developers that create modules for us to use in order to enhance our own projects. Today, we’ll look at some modules that are included with Python, how to import them, how to use them, and how to write our own modules to be used within Jupyter Notebook.
To follow along with this lesson, let’s continue from our notebook file “Week_09” and simply add a markdown cell at the bottom that says, “Modules.

Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   153   154   155   156   157   158   159   160   ...   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