diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/TestProject_05_08.iml b/.idea/TestProject_05_08.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/TestProject_05_08.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..3d35112 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,119 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..68dd909 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a2271f8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..fb0cff9 --- /dev/null +++ b/main.py @@ -0,0 +1,34 @@ +import math +def my_max(a, b): + if a>b: + return a + else: + return b + +def my_round(a): + b=a-int(a) + if b>=0.5: + return int(a)+1 + else: + return int(a) +l=35 +b=my_round(76.2) +print("Ceil result: ",b) +b=my_max(l,12) +print(b) +# k=1000 +# n=0 +# for i in range(2,math.ceil( math.sqrt(k))+1): +# if k%i==0: +# n=n+1 +# print(i ,'-delitel ',k) +# break +# if n>0: +# print("Chslov sostavnoe") +# else: +# print("Chislo prostoe") +# for i in range(1,101): +# if i%2==0: +# print(i, "-even number") +# else: +# print(i,"-odd number") diff --git a/oop.py b/oop.py new file mode 100644 index 0000000..f0248d1 --- /dev/null +++ b/oop.py @@ -0,0 +1,81 @@ + +class Person: + name = "Amir" + _age = 20 + _weigh = 74 + sex = "male" + + def get_weigh(self): + return self._weigh + + def set_weigh(self, w): + if w > 0: + self._weigh = w + + def get_age(self): + return self._age + + def set_age(self, a): + if a > 0: + self._age = a + + def print(self): + print(f"Name: {self.name}; \nAge: {self._age}; \nWeigh: {self._weigh}") + + def __init__(self, name, age, weigh, sex): + self.name = name + self._age = age + self._weigh = weigh + self.sex = sex + + +class Employee(Person): + salary=200000 + + +class Student(Person): + group=214 + + def print(self): + print(f"Group: {self.group};\nName: {self.name}; \nAge: {self._age}; \nWeigh: {self._weigh}") + pass + +s1=Student("Sanjar", 26, 73, "male") +s2=Student("Gulnora", 19, 60, "female") +e1=Employee("Samad", 22, 74, "male") +e2=Employee("Nigora", 22, 74, "famale") +e3=Employee("Madina", 22, 74, "female") +e4=Employee("Mansur", 17, 71, "male") + +a=[s1,s2,e1,e2,e3,e4] + +for p in a: + if p.get_age()>18 and p.sex=="male": + print("--------------------------") + p.print() + + + + +T sum(T a, T b) { + return a+b; +} + + +int k=sum(3,4); + +Vector v; + + + +# def my_max(a, b): +# if a > b: +# return a +# else: +# return b + + +# c = 17 +# a = 25 +# d = my_max(c, a) +# print("Result: ", d)