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



Download 2,61 Mb.
bet36/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   32   33   34   35   36   37   38   39   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

.split( )


I won’t go into too much detail with split simply because what it returns is a list and we haven’t covered those quite yet; however, I wanted you to see how to use this method. What it does is separate the words in the sentence into a group of words, stored within a list. Now don’t worry about lists just yet, we’ll get there. For now, let’s just see how this method works:

# converting a string into a list of words s = "These words are separated by spaces" print( s.split(" ") )

Go ahead and run the cell. The output results in a list of words “[‘These’, ‘words’,
are’, ‘separated’, ‘by’, ‘spaces’]”. We’ll come back to this method and why it’s important.

THURSDAY EXERCISES


1. Uppercasing: Try manipulating the string “uppercase” so it prints out as all uppercase letters. you’ll need to look up a new method.
2 . Strip Symbols: strip all the dollar signs from the left side of this string “$$John smith”. Try it with .lstrip( ) and .strip( ). To see a description on how to use the strip method further, try using the help function in python by typing the following:
>>> help(" ".strip)

Today you learned a handful of manipulation methods, but there are many more. Try experimenting with others that you find on the Web.
Friday: Creating a Receipt Printing Program
Welcome to your first project! We’ll be creating a very basic receipt printing program. For this week, as we’ve learned about variables, operators, and string manipulation, we’ll be using these skills in order to create this program.
ChApTer 2 pyThoN BAsICs
To follow along, let’s continue from our “Week_02” notebook and simply add a markdown cell at the bottom that says, “Friday Project: Printing Receipts.

Final Design


It’s always good to picture the design of what you’re trying to build. For larger projects, you’ll want to create a flow chart or some sort of design document that will keep you on track. This way you don’t sway from the intended result. For us, we’ll be building a small receipt printing program with the concepts we’ve learned, in which the output will look like Figure 2-2.

Figure 2-2. End result of Friday project
Let’s begin, shall we!

Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   32   33   34   35   36   37   38   39   ...   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