def read_students(): with open('students.txt', newline='') as student_csv: student_reader = csv.reader(student_csv, delimiter=',') for row in student_reader: # print(row) student = HighSchoolStudent(row[0],row[1],row[2]) student_list.append(student.get_name_capitalize()) return student_list # read_students()
from hs_student import HighSchoolStudent james = HighSchoolStudent("James") print(james)
from hs_student import HighSchoolStudent fred = HighSchoolStudent("fred") print(fred.get_name_capitalize()) print(fred.get_school_name()) print(fred.get_name())
from hs_student import HighSchoolStudent from student import Student import functions while True: student_name = input("Enter student name, or say No to exit :") if student_name.lower() == "no": print("Bye!") break student_id = input("Enter student id: ") student_type = input ("1)HighSchool or 2)Elementary?") if student_type == "1": tonio = HighSchoolStudent(student_name,student_id) # functions.add_student(tonio.student_name, tonio.student_id, "HS") else: tonio = Student(student_name) # functions.add_student(tonio.student_name, tonio.student_id, "EL") functions.save_into_file(student_name)
from hs_student import HighSchoolStudent james = HighSchoolStudent("James") print(james.get_name_capitalise())
def student(): hs = HighSchoolStudent('james') return hs.get_school_name()
from builtins import print from hs_student import HighSchoolStudent kota = HighSchoolStudent("kota") print(kota.get_name_capitalize())
from hs_student import HighSchoolStudent gurpreet = HighSchoolStudent("Gurpreet") print(gurpreet.get_school_name())
import student from hs_student import HighSchoolStudent # on line 12 we did a basic import, it means use this as the reference when # we want to use anything in this file, that means we have to use student # before we call our functions in another our student class we need to # tell python that we are looking in another file james = student.Student('james', 22) # notices the new student prefix to our instantiation, this is because our # import was not specific on what we are importing # now lets see what happens when we use our high school student module mike = HighSchoolStudent('mike', 9) # we don't need to add the prefix, but why? that's because we used the from # keyword and chose a specific part of the class to import # the import on line 13 reads 'from this file, import this thing' # we can also use an asterisk to mark 'all' members of the file like so from hs_student import * jenna = HighSchoolStudent('jenna', 8) # we can also use the 'as' keyword to give a new name to what were importing # lets see how that works import student as stdt jimmy = stdt.Student('jimmy', 55)
from hs_student import HighSchoolStudent john = HighSchoolStudent("pete", 1234) print(john.get_name_capitalize())
from hs_student import HighSchoolStudent # create high school instance james = HighSchoolStudent("james") print(james.get_name_capital()) # print name of high school student
from hs_student import HighSchoolStudent from student import Student # Calling StudentClass surya = Student("surya") print(surya.get_name_capitalize()) print(surya.get_school_name()) # Calling Inherited class suneel = HighSchoolStudent("suneel") print(suneel.get_name_capitalize()) print(suneel.get_school_name())
from student import Student from hs_student import HighSchoolStudent from classes import students print(Student.school_name) std = Student("sagar") print(std.get_school_name()) print(std) print(std.get_name_cap()) print(HighSchoolStudent.school_name) isha = HighSchoolStudent("Isha") print(isha.get_school_name()) print(isha) print(isha.get_name_cap()) print("students list :: ", students)
from hs_student import HighSchoolStudent james = HighSchoolStudent('james') print(james.get_name_capitalize())
# import hs_student # james = hs_student.HighSchoolStudent("james") from hs_student import HighSchoolStudent # from hs_student import * james = HighSchoolStudent("james") print(james.get_name_captialzie())
from hs_student import HighSchoolStudent james = HighSchoolStudent(1234, "james") print(james.get_name_capitalize())
from hs_student import HighSchoolStudent james = HighSchoolStudent("james") print(james.get_school_name())