You are on page 1of 4

for item in range(10)

##############################

list = [1, 2, 5, 11, 9, 4, 23, 11, 2, 5, 11, 21, 27]


uniques = []
list2 = list.copy()
list.reverse()
for index in list:
for dup in list:
list.count(dup)
if list.count(dup) > 1:
list.pop(list.index(dup))
list.reverse()
for dup in list2:
if dup not in uniques:
uniques.append(dup)
print(list)
print(uniques)

class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def move(self):
print("move")

def draw(self):
print("draw")

point1 = Point(10, 20)


point1.draw
point = Point(10,29)
point.x = 11
print(point.x)
#######################################

class Person:
def __init__(self, name):
self.name = name

def talk(self):
print(f"Hi, I am {self.name}")

john = Person("John Smith")


john.talk()
bob = Person("Bob Smith")
bob.talk()

####################
class Star:
def __init__(self, name, solar_masses, color):
self.name = name
self.mass = solar_masses
self.color = color
def star_class(self):
if self.color == "red" or self.color == "RED":
print(f'The star {self.name} is a Red Giant.')
elif self.color == "blue" or self.color == "BLUE":
print(f'The star {self.name} is a Blue Giant.')
elif self.color == "white" or self.color == "WHITE":
print(f'The star {self.name} is a White Dwarf.')
elif self.color == "yellow" or self.color == "YELLOW":
print(f'The star {self.name} is a Yellow K1 Star.')
else:
print("This is not a star category")

cond = True
name = input("Introduceti numele stelei: ")
a = 1
c = "red"
while cond:
try:
cond = False
a = float(input("Enter the mass of the star in solar masses. "))
except ValueError:
print("Mass must be a number.")
cond = True
b = str(input("Enter the star color. "))
while b.upper() != "RED" and b.upper() != "BLUE" and b.upper() != "WHITE" and
b.upper() != "YELLOW":
print("IEnter the star color red, blue, yellow or white.")
b = str(input())
vega = Star(name, a, b)
vega.star_class()
name = input("Introduceti numele celei de-a doua stele. ")
orion = Star(name, a, c)
c = str(input(f"Enter {orion.name} Star color. "))
orion = Star(name, a, c)
orion.star_class()

######################################
class Point:
def __init__(self, x, y):
self.distance = self.distance
self.x = x
self.y = y

def move(self, a, b):


self.x += a
self.y += b

def distance(self):
self.distance = (self.x * self.x + self.y * self.y) ** 0.5
print(f"Distanta dintre punctul ({self.x}, {self.y}) si (0,0) este:
{round(self.distance,2)}")

punct1 = Point(10, 20)


punct1.move(10, 10)
print(punct1.x)
punct1.move(30, 30)
punct1.move(30,30)
print(punct1.x)
punct1.distance()
print(punct1.y)

##############################

class Mamifere:
def __init__(self, name):
self.name = name

def walk(self):
print(f"{self.name} can walk.")

class Dogs(Mamifere):
def bark(self):
print(f"{self.name} shits.")

class Cats(Mamifere):
pass

pasare = Mamifere("Bija")
pasare.walk()
caine = Dogs("Cucu")
caine.bark()

customer = {"1": "One", "2": "Two", "3": 'Three', "4": 'Four', "5": 'Five', "6":
'Six', "7": 'Seven', "8": 'Eight',
"9": "Nine", "0": 'Zero'}

phone_number = input("Phone: ")


words = ""
for digit in phone_number:
words += customer.get(digit, 'N/A') + ' '
print(words)

############################################################

message = input("> ")


words = message.split(" ")
emoji = {
':)': "😍",
':(': '😒'
}
final_text = ''
for word in words:
final_text += emoji.get(word, word) + ' '
print(final_text)

###################################################
customer = {
"name": "Ion Vasile",
"age": 30,
"is_verified": True
}
customer['birthdate'] = '1 ianuarie 1980'
print(customer["name"])
print(customer.get('name', 'default_value_ceva_daca_name_nu_exista'))

You might also like