The document appears to be a fragmented code snippet containing functions related to student details, calculations, and file handling. It includes operations for reading student information, calculating total marks and percentages, and handling exceptions. Additionally, it features classes and methods for managing complex numbers and file backups.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views1 page
ajay py
The document appears to be a fragmented code snippet containing functions related to student details, calculations, and file handling. It includes operations for reading student information, calculating total marks and percentages, and handling exceptions. Additionally, it features classes and methods for managing complex numbers and file backups.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
1a def
read_student_de name, num = [] ) for line in lines], on by zero is not def
tails(): year_of_birth = key=len) allowed.") __init__(self, read_person_det print(f"Enter {n} name, usn): return { ails() numbers:") with return a / b open(output_file, self.name = 'Name': senior_citizen = for i in range(n): 'w') as file: try: name input("Enter the is_senior_citizen( student's name: year_of_birth) for line in self.usn = usn num.append(int(i a= "), nput()) sorted_lines: float(input("Enter print("\n--- the value of a: ")) self.marks = 'USN': Person Details file.write(line+'\ [] print(f"The read input("Enter the ---") n') list of numbers is: b= student's USN: "), {num}") float(input("Enter self.total = 0 print(f"Name: input_file = the value of b: ")) 'Marks': {name}") input("Enter the print(f"The mean [float(input(f"Ent of read data is: path to the input result = er marks for print(f"Year of {statistics.mean(n text file: ") DivExp(a, b) def subject {i}: ")) Birth: um)}") getMarks(self): {year_of_birth}") output_file = print(f"The for i in range(1, print(f"The input("Enter the result of {a} / {b} for i in 4)]} print("Senior variance of read path to the is: {result}") range(3): Citizen: Yes" if data is: output text file: def senior_citizen {statistics.varianc ") except mark = calculate_total_a else "Senior e(num)}") AssertionError as float(input(f"Ente nd_percentage(m Citizen: No") sort_file_content ae: r marks for arks): print(f"The s(input_file, subject {i+1}: ")) 2a n = standard output_file) total = int(input("Enter deviation of read print(f"Assertion sum(marks) the length of data is: print(f"Contents Error: {ae}") self.marks.appen sequence : ")) {statistics.stdev(n of {input_file} d(mark) return total, um)}") have been sorted except ValueError (total / 300) * ft = 0 and written to as ve: self.total = 100 4 def num = {output_file}.") sum(self.marks) st = 1 input("Enter a print(f"Value student = number: ") 7 import shutil Error: {ve}") read_student_de i=2 tails() print("The import os 9 class Complex: def print(ft,"\n",st) number entered is:", num) display(self): total, percentage def create(self, = while i<n: r, i): percentage = calculate_total_a def nd_percentage(st (self.total / 300) * tt = ft + st backup_folder_to udent['Marks']) self.real = r 100 # Assuming uniqDig = _zip(folder_name each subject is set(num) ): print(tt) self.imag = i out of 100 print("\n--- Student Details zip_file_name ---") ft = st print("\n--- = Score Card ---") for elem in f"{folder_name}.z print(f"Name: st = tt ip" def show(self): uniqDig: {student['Name']} ") i+=1 print(f"Name: print(elem, shutil.make_archi {self.name}") "occurs", ve(folder_name, print(f"{self.real} print(f"USN: 2b def num.count(elem) 'zip', + {self.imag}i") {student['USN']}" factorial(n): folder_name) print(f"USN: , "times") ) {self.usn}") if n == 0 or n 5 def print(f"Folder print(f"Total == 1: most_common_ '{folder_name}' def Marks: has been backed print(f"Marks: words(file_name, addComplex(x, {total:.2f}") up to {self.marks}") return 1 num_words): y): '{zip_file_name}'. print(f"Percentag ") print(f"Total else: with resComplex = e: Marks: open(file_name, Complex() {percentage:.2f} folder_name = {self.total}") return n * 'r') as file: %") factorial(n - 1) input("Enter the name of the words = resComplex.real 1b def folder to back up: print(f"Percentag def file.read().transla = x.real + y.real read_person_det ") e: binomial_coeffici te(str.maketrans(' ails(): {percentage:.2f} ent(n, r): ', '', if %") string.punctuatio resComplex.imag name = n)).lower().split() os.path.isdir(fold return = x.imag + y.imag input("Enter the er_name): factorial(n) // person's name: ") (factorial(r) * word_counts = return Counter(words) # Main program factorial(n - r)) resComplex year_of_birth = backup_folder_to int(input("Enter _zip(folder_name name = N= return the person's year ) input("Enter the int(input("Enter word_counts.mo of birth: ")) st_common(num student's name: the value of N: ")) a = Complex() _words) else: ") return name, R= print(most_com year_of_birth mon_words('text print(f"Folder a.create(9, 6) usn = int(input("Enter _file.txt', 10)) '{folder_name}' input("Enter the the value of R: ")) def does not exist in b = Complex() student's USN: ") is_senior_citizen( 6 def the current binom_coeff = year_of_birth): sort_file_content working b.create(4, 3) student = binomial_coeffici s(input_file, directory.") Student(name, ent(N, R) current_year = output_file): c= usn) 2025 # Update 8 def DivExp(a, addComplex(a, b) print(f"\nThe this to the with b): student.getMarks binomial current year open(input_file, c.show() () coefficient (C({N}, {R})) is: 'r') as file: assert a > 0, age = {binom_coeff}") "The value of 'a' student.display() current_year - lines = must be greater year_of_birth file.readlines() than 0." 3 import statistics
return age >= if b == 0:
n= 60 int(input("Enter the value of n: ")) sorted_lines = raise 10 class Student: sorted([line.strip( ValueError("Divisi