Пример #1
0
def AddStudents():
    code = (int)(input())
    fio = input()
    brithdate = input()
    email = input()
    phone = (int)(input())

    if 600000 > code or code < 190000:
        print('Код указан неверно')

    if re.match('[A-z]+', fio):
        print('Имя должно содержать русские буквы')
        return None
    if re.match('[A-z]+[.]+[A-z]+[@]+[A-z]+[.]+[A-z]', email):
        print('Почта указана неверно')
        return None
    #if len(phone) != 11 :
    #    print('Телефон должен иметь 11 цифр. Например:89141234567')

    return Student(code, fio, brithdate, email, phone)
Пример #2
0
    def addStudent(self):
        while True:
            try:
                idd = int(input("Please enter the id: "))
                break
            except ValueError:
                print("Invalid id.")

        name = str(input("Please enter the name: "))
        while True:
            try:
                group = int(input("Please enter the group: "))
                break
            except ValueError:
                print("Invalid group.")

        s = Student(idd, name, group)
        sVal.validate(s)
        sRepo.add(s)
        self.uiStudents()
Пример #3
0
import unittest
from io import StringIO
from unittest.mock import patch
import datetime
import StudentsManager
from Students import Student

Students = [
    Student(191364, 'Иванов Иван Иванович', '1.01.2000', '*****@*****.**',
            89141234567)
]


class Tester(unittest.TestCase):
    @patch('sys.stdout', new_callable=StringIO)
    def testCreateStudent_true(self, mock_out):
        user_input = [
            191364, 'Иванов Иван Иванович', '1.01.2000', '*****@*****.**',
            89141234567
        ]
        with patch('builtins.input', side_effect=user_input):
            new_student = StudentsManager.AddStudents()
        self.assertEqual(new_student.code, user_input[0])
        self.assertEqual(new_student.fio, user_input[1])
        self.assertEqual(new_student.brithdate,
                         datetime.datetime.strptime(user_input[2], '%d.%m.%Y'))
        self.assertEqual(new_student.email, user_input[3])
        self.assertEqual(new_student.phone, user_input[4])

    @patch('sys.stdout', new_callable=StringIO)
    def testCreateStudent_false(self, mock_out):
Пример #4
0
# An Object is Instance Of a Class.
# Create a Student Name With The Following Attributes.


from Students import Student

from Students import Students_female

from Students import Students_Mobile

from Students import Students_female_Mobile
from Students import intelligent_Student
from Students import Students_with_Laptops

Students1 = Student('Specky\n', 'Computer Science\n', 4.0, False)

Students_female = Students_female('Illusionnist\n', 'Information Technology\n', 3.0, True)

print(Students1.name, Students1.major, Students1.gpa, Students1.is_on_probation)

print(Students_female.name, Students_female.major, Students_female.gpa, Students_female.is_intern_or_not)

Students_Mobile = Students_Mobile('Note 7s\n', 'Pie 9\n', 10000, False)
Students_female_Mobile = Students_female_Mobile('Iphone 6s\n', 'IOS 11\n', 50000, True)

print(Students_Mobile.Model, Students_Mobile.Operating_system, Students_Mobile.A_version, Students_Mobile.is_Costly_or_not)

print(Students_female_Mobile.Model, Students_female_Mobile.Operating_system, Students_female_Mobile.A_version, Students_female_Mobile.is_Costly_or_not)

Students = intelligent_Student(True, 'Average Student\n', 'Not\n', True)
Пример #5
0
from Students import Student

Student1 = Student("Nick-Bwalley", 122790, "DBIT", 2.9)
Student2 = Student("Drew Mc-Intyre", 122994, "DBIT", 3.6)
Student3 = Student("Seth Rollins", 122799, "DBIT", 3.9)

print(Student1.on_honor_roll())
print(Student2.on_honor_roll())
print(Student3.on_honor_roll())
Пример #6
0
# _*_ coding:UTF-8 _*_
# 开发人员: 理想国真恵玩-张大鹏
# 开发团队: 理想国真恵玩
# 开发时间: 2019-04-15 21:37
# 文件名称: hw_005_包.py
# 开发工具: PyCharm

# 包就是包含 __init__.py的文件夹
# 包里面装的一般都是各种Python类
# 导入我们自己写的包

# 方法1
from Students import Student

Student.Student.static_method()

# 方法2
from Students.Student import Student

lky = Student('李珂瑶', 18)
print(lky.name)
print(lky.age)
lky.show()
print('--' * 22)
lky = Student('张宝富', 33)
print(lky.name)
print(lky.age)
lky.show()
Пример #7
0
def main():

    W01234 = Student('David', 'Luna')  #Instance of the Student Class
    W01235 = Student('Waldo', 'Wildcat')

    #print('Passing Grade: ', W01234.passing_grade, W01234.first)
    #print('Passing Grade: ', W01235.passing_grade, W01235.first)

    #Student.setPassingGrade(65)

    #print('Passing Grade: ', W01234.passing_grade, W01234.first)
    #print('Passing Grade: ', W01235.passing_grade, W01235.first)

    print('Start of the semester')
    print('---------------------')
    W01234.printStudentInfo()
    W01235.printStudentInfo()

    print('Middle of the semester')
    print('---------------------')

    W01234.setGrade(45)
    W01235.setGrade(75)

    W01234.printStudentInfo()
    W01235.printStudentInfo()

    print('End of the semester')
    print('---------------------')

    W01234.extraCredit(30)

    W01234.printStudentInfo()
    W01235.printStudentInfo()
Пример #8
0
from Students import Student, HighSchool, Graduation

Student = Student(1, 'Laura', 88801)
StudentHG = HighSchool(2, 'Eduardo', 88802, 2019)
StudentG = Graduation(3, 'Joana', 88803, 4)

opcao = ""
while (opcao != "0"):
    print("\n----------------------")
    print("1 - Student")
    print("2 - Student High School")
    print("3 - Student Graduation")
    print("0 - Sair")
    print("\n----------------------")

    opcao = input("Digite uma opção: ")

    if opcao == "1":
        Student.printStudent()
        print('-' * 20)
        break

    if opcao == "2":
        StudentHG.printHighSchool()
        print('-' * 20)
        break

    if opcao == "3":
        StudentG.printGraduation()
        print('-' * 20)
        break
Пример #9
0
def main ():

W01234 = Student('Kyle', 'Anderson') #instance of Student Class
W01235 = Student('Willy','Wanka')

print('Start of the semester')
print('-----------------------')

W01234.extraCredit(30)

print(W01234.passing_grade)
print(W01235.first, W01235.last, W01235.email, W01235.status)


print(W01234)
print(W01235)

W01234.first = "Kyle"
W01234.last = "Anderson"
W01234.Email = "*****@*****.**"
W01234.status = "Pass"

W01235.first = "Willy"
W01235.last = "Wonka"
W01235.email = "*****@*****.**"
W01235.status = "Pass"

# print(W01234.email)
# print(W01235.email)





if __name__ == "__main__":
    main