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



Download 2,61 Mb.
bet119/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   115   116   117   118   119   120   121   122   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

THURSDAY EXERCISES


1 . Good Guys/Bad Guys: Create three classes, a superclass called “Characters” that will be defined with the following attributes and methods:

  1. Attributes: name, team, height, weight

  2. Methods: sayHello

the sayHello method should output the statement “Hello, my name is Max and I’m on the good guys”. the team attribute should be declared to a string of either “good” or “bad.” the other two classes, which will be subclasses, will be “GoodPlayers” and “BadPlayers.” both classes will inherit “Characters” and super all the attributes that the superclass requires. the subclasses do not need any other methods or attributes. instantiate one player on each team, and call the sayHello method for each. the output should result in the following:
>>> "Hello, my name is Max and I'm on the good guys"
>>> "Hello, my name is Tony and I'm on the bad guys"

today was all about inheritance in OOp. Using inheritance, we can cut down on the repetitive lines that we write between similar classes. inherited classes are known as superclasses, while those that perform the inheritance are known as subclasses. also, the ability to override inherited methods is called method overriding and provides class customization for subclasses.
Friday: Creating Blackjack
Throughout this week, we’ve learned all about how to use classes in Python to improve our programs. Today, we’ll put all that knowledge together and build the popular game Blackjack together. We’ll use classes throughout the program, and you’ll be able to see how we are able to structure a full-fledged object-oriented game in Python. It is assumed that you know how to play Blackjack. If not, feel free to look up the rules and steps on how to play.
To follow along with this lesson, let’s continue from our previous notebook file
Week_07” and add a markdown cell at the bottom that says, “Friday Project: Creating Blackjack.

Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   115   116   117   118   119   120   121   122   ...   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