
import time
class Creator():
def __init__(self,life,defense,damage):
self.level = 1
self.experience = 0
self.life = life
self.defense = defense
self.damage = damage
self.critical = 10
def attack(self,user):
user.life -= self.damage - user.defense
hero = Creator(100,10,40)
creature = Creator(40,10,20)
def attack_creature():
creature_no = int(input("How many Creatures do you want to attack"))
while True:
input("Press Enter to attack.")
time.sleep(2)
hero.attack(creature)
if creature.life <=0 and creature_no==1:
print("Creatures is death, You won!")
break
elif creature.life <=0 and creature_no>1:
creature_no -= 1
print(f"You killed 1 creature and {creature_no} creatures are left.")
creature.life = 40
print(f"Creature has {creature.life} life.")
time.sleep(2)
print("Now creature are attacking you.")
time.sleep(2)
for i in range(creature_no):
creature.attack(hero)
if hero.life <=0:
print("You are death, You lost!")
break
print(f"You have {hero.life} life.")
def main():
print("""
1 Attack Creatures
2 Attack Boss""")
choce = int(input("What do you want to do?"))
if choce ==1:
attack_creature()
main()
import time
class Creator():
def __init__(self,life,defense,damage):
self.level = 1
self.experience = 0
self.life = life
self.defense = defense
self.damage = damage
self.critical = 10
def attack(self,user):
user.life -= self.damage - user.defense
hero = Creator(100,10,40)
creature = Creator(40,10,20)
def attack_creature():
creature_no = int(input("How many Creatures do you want to attack"))
version = int(input("""
1 Show the details.
2 Don't show the details."""))
if version ==1:
while True:
input("Press Enter to attack.")
time.sleep(2)
hero.attack(creature)
if creature.life <=0 and creature_no==1:
print("Creatures is death, You won!")
break
elif creature.life <=0 and creature_no>1:
creature_no -= 1
print(f"You killed 1 creature and {creature_no} creatures are left.")
creature.life = 40
print(f"Creature has {creature.life} life.")
time.sleep(2)
print("Now creature are attacking you.")
time.sleep(2)
for i in range(creature_no):
creature.attack(hero)
if hero.life <=0:
print("You are death, You lost!")
break
print(f"You have {hero.life} life.")
elif version ==2:
while True:
hero.attack(creature)
if creature.life <= 0 and creature_no == 1:
print("Creatures is death, You won!")
break
elif creature.life <= 0 and creature_no > 1:
creature_no -= 1
creature.life = 40
for i in range(creature_no):
creature.attack(hero)
if hero.life <= 0:
print("You are death, You lost!")
break
def main():
print("""
1 Attack Creatures
2 Attack Boss""")
choce = int(input("What do you want to do?"))
if choce ==1:
attack_creature()
main()
import time
import random
class Creator():
def __init__(self,life,defense,damage):
self.level = 1
self.experience = 0
self.life = life
self.defense = defense
self.damage = damage
self.critical = 50
self.penetrating = 60
def attack(self,user):
if random.randint(1,100) <= self.critical:
if random.randint(1,100) <= self.penetrating:
user.life -= self.damage * 2
else:
user.life -= (self.damage - user.defense) * 2
else:
if random.randint(1,100) <= self.penetrating:
user.life -= self.damage
else:
user.life -= self.damage - user.defense
hero = Creator(100,10,40)
creature = Creator(40,10,20)
def attack_creature():
creature_no = int(input("How many Creatures do you want to attack"))
version = int(input("""
1 Show the details.
2 Don't show the details."""))
if version ==1:
while True:
input("Press Enter to attack.")
time.sleep(2)
hero.attack(creature)
if creature.life <=0 and creature_no==1:
print("Creatures is death, You won!")
break
elif creature.life <=0 and creature_no>1:
creature_no -= 1
print(f"You killed 1 creature and {creature_no} creatures are left.")
creature.life = 40
print(f"Creature has {creature.life} life.")
time.sleep(2)
print("Now creature are attacking you.")
time.sleep(2)
for i in range(creature_no):
creature.attack(hero)
if hero.life <=0:
print("You are death, You lost!")
break
print(f"You have {hero.life} life.")
elif version ==2:
while True:
hero.attack(creature)
if creature.life <= 0 and creature_no == 1:
print("Creatures is death, You won!")
break
elif creature.life <= 0 and creature_no > 1:
creature_no -= 1
creature.life = 40
for i in range(creature_no):
creature.attack(hero)
if hero.life <= 0:
print("You are death, You lost!")
break
def main():
print("""
1 Attack Creatures
2 Attack Boss""")
choce = int(input("What do you want to do?"))
if choce ==1:
attack_creature()
main()
import time
import random
class Creator():
def __init__(self,life,defense,damage):
self.level = 1
self.experience = 0
self.life = life
self.defense = defense
self.damage = damage
self.critical = 10
self.penetrating = 10
def attack(self,user):
if random.randint(1,100) <= self.critical:
if random.randint(1,100) <= self.penetrating:
user.life -= self.damage * 2
else:
user.life -= (self.damage - user.defense) * 2
else:
if random.randint(1,100) <= self.penetrating:
user.life -= self.damage
else:
user.life -= self.damage - user.defense
hero = Creator(100,10,40)
creature = Creator(40,10,20)
def increase_level():
hero.level+=1
print(f"Your level is {hero.level}")
print("""
1 Life
2 Defense
3 Damage
4 Critical hit chance
5 Penetrating chance""")
option= int(input("Which one do you want to increase?"))
if option ==1:
hero.life+=10
print(f"Now you have {hero.life} life")
elif option ==2:
hero.defense += 2
print(f"Now you have {hero.defense} defense.")
elif option ==3:
hero.damage += 2
print(f"Now you have {hero.damage} damage.")
elif option ==4:
hero.critical += 1
print(f"Now you have {hero.critical} critical hit chance.")
elif option ==5:
hero.penetrating += 1
print(f"Now you have {hero.penetrating} penetrating.")
else:
pass
def attack_creature():
creature_no = int(input("How many Creatures do you want to attack"))
no_exp= creature_no
hero_life = hero.life
version = int(input("""
1 Show the details.
2 Don't show the details."""))
if version ==1:
while True:
input("Press Enter to attack.")
time.sleep(2)
hero.attack(creature)
if creature.life <=0 and creature_no==1:
print("Creatures are death, You won!")
hero.experience += no_exp*50
if hero.experience>=hero.level*100:
hero.life = hero_life
increase_level()
break
elif creature.life <=0 and creature_no>1:
creature_no -= 1
print(f"You killed 1 creature and {creature_no} creatures are left.")
creature.life = 40
print(f"Creature has {creature.life} life.")
time.sleep(2)
print("Now creatures are attacking you.")
time.sleep(2)
for i in range(creature_no):
creature.attack(hero)
if hero.life <=0:
print("You are death, You lost!")
hero.life = hero_life
break
print(f"You have {hero.life} life.")
elif version ==2:
while True:
hero.attack(creature)
if creature.life <= 0 and creature_no == 1:
print("Creatures are death, You won!")
hero.experience += no_exp * 50
if hero.experience >= hero.level * 100:
hero.life = hero_life
increase_level()
break
elif creature.life <= 0 and creature_no > 1:
creature_no -= 1
creature.life = 40
for i in range(creature_no):
creature.attack(hero)
if hero.life <= 0:
print("You are death, You lost!")
hero.life = hero_life
break
def main():
print("""
1 Attack Creatures
2 Attack Boss""")
choce = int(input("What do you want to do?"))
if choce ==1:
attack_creature()
main()
import time
import random
class Creator():
def __init__(self,life,defense,damage):
self.level = 1
self.experience = 0
self.life = life
self.defense = defense
self.damage = damage
self.critical = 10
self.penetrating = 10
def attack(self,user):
if random.randint(1,100) <= self.critical:
if random.randint(1,100) <= self.penetrating:
user.life -= self.damage * 2
else:
user.life -= (self.damage - user.defense) * 2
else:
if random.randint(1,100) <= self.penetrating:
user.life -= self.damage
else:
user.life -= self.damage - user.defense
hero = Creator(100,10,40)
creature = Creator(40,10,20)
def increase_level():
hero.level+=1
print(f"Your level is {hero.level}")
print("""
1 Life
2 Defense
3 Damage
4 Critical hit chance
5 Penetrating chance""")
option= int(input("Which one do you want to increase?"))
if option ==1:
hero.life+=10
print(f"Now you have {hero.life} life")
elif option ==2:
hero.defense += 2
print(f"Now you have {hero.defense} defense.")
elif option ==3:
hero.damage += 2
print(f"Now you have {hero.damage} damage.")
elif option ==4:
hero.critical += 1
print(f"Now you have {hero.critical} critical hit chance.")
elif option ==5:
hero.penetrating += 1
print(f"Now you have {hero.penetrating} penetrating.")
else:
pass
def attack_creature():
creature_no = int(input("How many Creatures do you want to attack"))
no_exp= creature_no
hero_life = hero.life
version = int(input("""
1 Show the details.
2 Don't show the details."""))
if version ==1:
while True:
input("Press Enter to attack.")
time.sleep(2)
hero.attack(creature)
if creature.life <=0 and creature_no==1:
print("Creatures are death, You won!")
hero.experience += no_exp*50
if hero.experience>=hero.level*100:
hero.life = hero_life
increase_level()
hero.experience=0
break
elif creature.life <=0 and creature_no>1:
creature_no -= 1
print(f"You killed 1 creature and {creature_no} creatures are left.")
creature.life = 40
print(f"Creature has {creature.life} life.")
time.sleep(2)
print("Now creatures are attacking you.")
time.sleep(2)
for i in range(creature_no):
creature.attack(hero)
if hero.life <=0:
print("You are death, You lost!")
hero.life = hero_life
break
print(f"You have {hero.life} life.")
elif version ==2:
while True:
hero.attack(creature)
if creature.life <= 0 and creature_no == 1:
print("Creatures are death, You won!")
hero.experience += no_exp * 50
if hero.experience >= hero.level * 100:
hero.life = hero_life
increase_level()
hero.experience = 0
break
elif creature.life <= 0 and creature_no > 1:
creature_no -= 1
creature.life = 40
for i in range(creature_no):
creature.attack(hero)
if hero.life <= 0:
print("You are death, You lost!")
hero.life = hero_life
break
def main():
while True:
print("""
1 Attack Creatures
2 Attack Boss
3 Exit
""")
choce = int(input("What do you want to do?"))
if choce ==1:
attack_creature()
elif choce ==2:
pass
elif choce ==3:
break
main()
Python is a programming language that is intended for both total beginners who have never coded before and experienced programmers who wish to broaden their career choices by learning Python. Python is, in reality, one of the most widely used programming languages in the world, with major corporations such as Google using it in mission-critical systems such as Google Search to great effect. Python, on the other hand, is the most popular programming language for machine learning, data science, and artificial intelligence. If you want to get one of those high-paying positions, you'll need to be an expert in Python, which is exactly what you'll learn from this course.
You will master OOP with Python programming language in this course. Firstly, we will learn the basics about OOP, then we will make a game by using "Class". In this way, you will understand how the "class" work in Python.
Once you've completed the course, you'll be ready to submit applications with confidence for Python programming positions. And, sure, this is true even if you have never coded in your life before to now. You may become employable and useful in the eyes of future employers if you have the appropriate abilities, which you will acquire in this course and practice.
If you have any questions about this course, please contact me as soon as possible and I will respond to you the same day. With the help of this course, you will learn how to make your lives simpler by becoming familiar with the Python programming language. This will keep you motivated on a daily basis and prevent you from becoming bored while studying Python.