Skip to content

Commit b575287

Browse files
Add files via upload
1 parent 6a635ab commit b575287

File tree

9 files changed

+685
-0
lines changed

9 files changed

+685
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class DataType:
2+
def __init__(self, name, value):
3+
self.name = name
4+
self.value = value
5+
6+
7+
data_type1 = DataType("Integer", 1234)
8+
print(data_type1.name)
9+
print(data_type1.value)
10+
print("=====================")
11+
data_type2 = DataType("String", "Hello")
12+
print(data_type2.name)
13+
print(data_type2.value)
14+
print("=====================")
15+
data_type3 = DataType("Float", 4.0)
16+
print(data_type3.name)
17+
print(data_type3.value)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class Flower:
2+
def __init__(self):
3+
pass
4+
5+
6+
flower1 = Flower()
7+
flower1.name = "Rose"
8+
flower1.color = "Red"
9+
flower1.num_of_petal = 6
10+
print("Name of this flower:", flower1.name)
11+
print("Color of this flower:", flower1.color)
12+
print("Number of petal:", flower1.num_of_petal)
13+
print("=====================")
14+
# ======================================================================#
15+
flower2 = Flower()
16+
flower2.name = "Orchid"
17+
flower2.color = "Purple"
18+
flower2.num_of_petal = 4
19+
print("Name of this flower:", flower2.name)
20+
print("Color of this flower:", flower2.color)
21+
print("Number of petal:", flower2.num_of_petal)
22+
# ======================================================================#
23+
print("flower1 memory adress: ", flower1)
24+
print("flower2 memory adress: ", flower2)
25+
if flower2 == flower1:
26+
print("They are same")
27+
else:
28+
print("They are different")
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class Wadiya:
2+
def __init__(self):
3+
self.name = "Aladeen"
4+
self.designation = "President Prime Minister Admiral General"
5+
self.num_of_wife = 100
6+
self.dictator = True
7+
8+
9+
wadiya = Wadiya()
10+
print("Part 1:")
11+
print(f"Name of President: {wadiya.name}")
12+
print(f"Designation: {wadiya.designation}")
13+
print(f"Number of wife: {wadiya.num_of_wife}")
14+
print(f"Is he/she a dictator: {wadiya.dictator}")
15+
print("=====================")
16+
# ==================================================================== #
17+
# Changing values
18+
wadiya.name = "Donald-Trump"
19+
wadiya.designation = "President"
20+
wadiya.num_of_wife = 1
21+
wadiya.dictator = False
22+
# ==================================================================== #
23+
print("Part 2:")
24+
print(f"Name of President: {wadiya.name}")
25+
print(f"Designation: {wadiya.designation}")
26+
print(f"Number of wife: {wadiya.num_of_wife}")
27+
print(f"Is he/she a dictator: {wadiya.dictator}")
28+
print("=====================")
29+
print("privious information lost")
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class Joker:
2+
def __init__(self, name, power, is_he_psycho):
3+
self.name = name
4+
self.power = power
5+
self.is_he_psycho = is_he_psycho
6+
7+
8+
j1 = Joker("Heath Ledger", "Mind Game", False)
9+
print(j1.name)
10+
print(j1.power)
11+
print(j1.is_he_psycho)
12+
print("=====================")
13+
j2 = Joker("Joaquin Phoenix", "Laughing out Loud", True)
14+
print(j2.name)
15+
print(j2.power)
16+
print(j2.is_he_psycho)
17+
print("=====================")
18+
19+
if j1 == j2:
20+
print("same")
21+
else:
22+
print("different")
23+
24+
j2.name = "Heath Ledger"
25+
if j1.name == j2.name:
26+
print("same")
27+
else:
28+
print("different")
29+
30+
print("=====================")
31+
# Subtask -2
32+
print(
33+
"Because they are 2 different instances of Joker class & their memory locations are different"
34+
)
35+
# Subtask -3
36+
print("Because j1.name & j2.name have the same string.")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class Pokemon:
2+
def __init__(
3+
self, pokemon1_name, pokemon2_name, pokemon1_power, pokemon2_power, damage_rate
4+
):
5+
self.pokemon1_name = pokemon1_name
6+
self.pokemon2_name = pokemon2_name
7+
self.pokemon1_power = pokemon1_power
8+
self.pokemon2_power = pokemon2_power
9+
self.damage_rate = damage_rate
10+
11+
12+
team_pika = Pokemon("pikachu", "charmander", 90, 60, 10)
13+
print("=======Team 1=======")
14+
print("Pokemon 1:", team_pika.pokemon1_name, team_pika.pokemon1_power)
15+
print("Pokemon 2:", team_pika.pokemon2_name, team_pika.pokemon2_power)
16+
pika_combined_power = (
17+
team_pika.pokemon1_power + team_pika.pokemon2_power
18+
) * team_pika.damage_rate
19+
print("Combined Power:", pika_combined_power)
20+
# ============================================================================== #
21+
team_bulb = Pokemon("bulbasaur", "squirtle", 80, 70, 9)
22+
print("=======Team 1=======")
23+
print("Pokemon 1:", team_bulb.pokemon1_name, team_bulb.pokemon1_power)
24+
print("Pokemon 2:", team_bulb.pokemon2_name, team_bulb.pokemon2_power)
25+
bulb_combined_power = (
26+
team_bulb.pokemon1_power + team_bulb.pokemon2_power
27+
) * team_bulb.damage_rate
28+
print("Combined Power:", bulb_combined_power)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Player:
2+
def __init__(self):
3+
pass
4+
5+
6+
player1 = Player()
7+
player1.name = "Ronaldo"
8+
player1.jersy_number = 9
9+
player1.position = "Striker"
10+
print("Name of the Player:", player1.name)
11+
print("Jersey Number of player:", player1.jersy_number)
12+
print("Position of player:", player1.position)
13+
print("===========================")
14+
player2 = Player()
15+
player2.name = "Neuer"
16+
player2.jersy_number = 1
17+
player2.position = "Goal Keeper"
18+
print("Name of the player:", player2.name)
19+
print("Jersey Number of player:", player2.jersy_number)
20+
print("Position of player:", player2.position)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Country:
2+
def __init__(self):
3+
self.name = "Bangladesh"
4+
self.continent = "Asia"
5+
self.capital = "Dhaka"
6+
self.fifa_ranking = 187
7+
8+
9+
country = Country()
10+
print("Name:", country.name)
11+
print("Continent:", country.continent)
12+
print("Capital:", country.capital)
13+
print("Fifa Ranking:", country.fifa_ranking)
14+
print("===================")
15+
country.name = "Belgium"
16+
country.continent = "Europe"
17+
country.capital = "Brussels"
18+
country.fifa_ranking = 1
19+
print("Name:", country.name)
20+
print("Continent:", country.continent)
21+
print("Capital:", country.capital)
22+
print("Fifa Ranking:", country.fifa_ranking)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
class DemonSlayer:
2+
def __init__(self, name, style, number_of_technique, kill):
3+
self.name = name
4+
self.style = style
5+
self.number_of_technique = number_of_technique
6+
self.kill = kill
7+
8+
9+
tanjiro = DemonSlayer("Tanjiro", "Water Breathing", 10, 10)
10+
print("Name:", tanjiro.name)
11+
print("Fighting Style:", tanjiro.style)
12+
print(
13+
f"Knows {tanjiro.number_of_technique} technique(s) and has killed {tanjiro.kill} demon(s)"
14+
)
15+
print("===================")
16+
zenitsu = DemonSlayer("Zenitsu", "Thunder Breathing", 1, 4)
17+
print("Name:", zenitsu.name)
18+
print("Fighting Style:", zenitsu.style)
19+
print(
20+
f"Knows {zenitsu.number_of_technique} technique(s) and has killed {zenitsu.kill} demon(s)"
21+
)
22+
print("===================")
23+
inosuke = DemonSlayer("Inosuke", "Beast Breathing", 5, 7)
24+
print("Name:", inosuke.name)
25+
print("Fighting Style:", inosuke.style)
26+
print(
27+
f"Knows {inosuke.number_of_technique} technique(s) and has killed {inosuke.kill} demon(s)"
28+
)
29+
print("===================")
30+
print(
31+
f"{tanjiro.name}, {zenitsu.name}, {inosuke.name} knows total {tanjiro.number_of_technique + zenitsu.number_of_technique + inosuke.number_of_technique} techniques"
32+
)
33+
print(f"They have killed total {tanjiro.kill + zenitsu.kill + inosuke.kill} demons")

0 commit comments

Comments
 (0)