Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python #47

Open
wants to merge 1 commit into
base: Kuvshinov_Vladislav_Sergeevich
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions python/src/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
def summ(a: int, b: int) -> int:
return a + b
import primer1
import structure

print(primer1.taskone(0.26, 0.66, 0.08))
print(primer1.tasktwo(0.1, 0.35, 0.4, 0.55,0.6))

if __name__ == "__main__":
print("Hello world")
print(summ(3, 4))


chel = structure.Character("Владик Пармезан",7,8,7,8)
chel.print_overall_info()
chel.event()
19 changes: 19 additions & 0 deletions python/src/primer1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import math

def calculate(x):
return (((math.asin(x))**2 + (math.acos(x))**4)**3)

def taskone(x_s,x_e,x_k):
results=[]
while x_s < x_e:
results.append(calculate(x_s))
x_s+=x_k
return results

def tasktwo(x1,x2,x3,x4,x5):
results2=[]
for a in x1,x2,x3,x4,x5:
results2.append(calculate(a))
return results2


83 changes: 83 additions & 0 deletions python/src/structure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from random import randint

class Character:
def __init__(self, name, intellect, psyche, physique, motorics):
self.__name = name
self.__intellect = intellect
self.__psyche = psyche
self.__physique = physique
self.__motorics = motorics

@property
def name(self):
return self.__name


@property
def intellect(self):
return self.__intellect

@intellect.setter
def intellect(self, intellect):
if 0 < intellect < 11:
self.__intellect = intellect
else:
print("Количество очков интеллекта может быть только от 1 до 10.")


@property
def psyche(self):
return self.psyche

@psyche.setter
def psyche(self, psyche):
if 0 < psyche < 11:
self.__psyche = psyche
else:
print("Количество очков психики может быть только от 1 до 10.")


@property
def physique(self):
return self.physique

@physique.setter
def physique(self, physique):
if 0 < physique < 11:
self.__physique = physique
else:
print("Количество очков физиологии может быть только от 1 до 10.")


@property
def motorics(self):
return self.motorics

@motorics.setter
def motorics(self, motorics):
if 0 < motorics < 11:
self.__motorics = motorics
else:
print("Количество очков моторики может быть только от 1 до 10.")


def print_overall_info(self):
if 0 < self.__intellect < 11 and 0 < self.__psyche < 11 and 0 < self.__physique < 11 and 0 < self.__motorics < 11:
print(f"Имя: {self.__name}\nИнтеллект: {self.__intellect}\nПсихика: {self.__psyche}\nФизиология: {self.__physique}\nМоторика: {self.__motorics}\n")
else:
print("Параметры персонажа были заданы неверно: характеристики могут принимать значения только от 1 до 10.")

def event(self):
if 0 < self.__intellect < 11 and 0 < self.__psyche < 11 and 0 < self.__physique < 11 and 0 < self.__motorics < 11:
a = randint(4, 53)
b = randint(2, 13)
all = self.__intellect + self.__psyche + self.__physique + self.__motorics
if (all + b)>= a:
print(f"Событие пройдено успешно.\nБыло необходимо очков:{a}\nСумма характеристик составила:{all}\nКубики выбросили число:{b}\nСумма ваших очков:{all + b}")
else:
print(f"Событие провалено.\nБыло необходимо очков:{a}\nСумма характеристик составила:{all}\nКубики выбросили число:{b}")
else:
print("Параметры персонажа были заданы неверно: характеристики могут принимать значения только от 1 до 10.")