SRM INSTITUTE OF SCIENCE AND TECHNOLOGY Ramapuram, Chennai FACULTY OF SCIENCE AND HUMANITIES Department of Computer Applications (BCA) PRACTICAL RECORD NAME : REGISTER NO : COURSE : B. C. A - (COMPUTER APPLICATIONS) SEMESTER / YEAR : V / III SUBJ ECT CODE : UCA23501J SUBJECT NAME : PYTHON PROGRAMMING OCTOBER 2025 SRM INSTITUTE OF SCIENCE AND TECHNOLOGY Ramapuram, Chennai FACULTY OF SCIENCE AND HUMANITIES Department of Computer Applications (BCA) BONAFIDE CERTIFICATE This is to ce rtify that the Bonafide work done by in the subject PYTHON PROGRAMMING (UCA23501J) at SRM Institute of Science and Technology, Faculty of Science and Humanities, Ramapuram, Chennai in October 2025. STAFF IN CHARGE HEAD OF THE DEPARTMENT Submit ted for the University Practical Examination held at SRM Institute of Science and Technology, Faculty of Science and Humanities, Ramapuram, Chennai held on INTERNAL EXAMINER 1 INTERNAL EXAMINER 2 REGISTER NUMBER: INDEX S.NO DATE EXPERIMENTS PAGE NO SIGN 1 Write a Python code to display system information using pywhois 2 The Magic 8 Ball is a toy used for fortune - telling or seeking advice. 3 Check whether a number is prime or not Python Program to Generate a Random Number 4 Make a simple calculator 5 Find the Factorial of a Number ii) Python Program to Convert Decimal to Binary, Octal and Hexadecimal 6 Program to read and write text and numbers 7 Program to Transpose a Matrix Program to List Methods for Inserting Elements 8 Usin g a List to Find the Median of a Set of Numbers Program using sorting and searching 9 When the user enters a statement, the program responds in one of two ways: 1 With a randomly chosen hedge, such as “Please tell me more.” 2 By changing some key word s in the user’s input string and appending this string to a randomly chosen qualifier. Thus, to “My teacher always plays favorites,” the program might reply, “Why do you say that your teacher always plays favorites? 10 Program using recursive function 11 Write the code for a mapping that generates a list of the absolute values of the numbers in a list named numbers. 12 Write the code for a mapping that generates a list of the even numbers in a list of number 13 Program using classes and m ethods 14 Python Program for Operator overloading 15 Program using Polymorphism, Abstract classes Ex no: Name : Date: Reg. No: Python code to display system information usi ng pywhois Aim: To write a python code to display system information using Program: import platform my_system = platform.uname() print(f"System: {my_system.system}") print(f"Node Name: {my_system.node}") print(f"Release: {my_system.release}") print(f" Version: {my_system.version}") print(f"Machine: {my_system.machine}") print(f"Processor: {my_system.processor}") Sample screenshot: Input: Output: Result: Thus the above program has been executed successfully. Ex no: Name : Date: Reg. No: The Magic 8 Ball is a toy used for fortune - telling or seeking advice. Aim: To Write a python program to create the magic 8 ball is a toy used for fortune - telling or seeking advice. Program: import random ans1=True while ans1: que=input("Ask the magic 8 ball a question(1 - 8) press .(dot) if you want to exit") print(" \ n") anss=random.randint(1,8) if que== ".": sys.exit() elif anss== 1: print("It is certain") elif anss== 2: print("Outlook good") elif anss== 3: print("You may rely on it") elif anss== 4: print("Ask again later") elif anss==5: print("Concentrate and ask again") elif anss== 6: print("Reply hazy, try again") elif anss== 7: print("My reply is no") elif anss== 8: print("My sources say no" ) Sample Screenshot: Input: Output: Result: Thus the above program has been executed successfully. Ex no: Name : Date: Reg. No: Check whether a number is prime or not Python Program to G enerate a Random Number Aim: To Write a python program to Check whether a number is prime or not Python Program to Generate a Random Number Program: num = int(input("Enter a number: ")) # prime numbers are greater than 1 if num > 1: # check for fact ors for i in range(2,num): if (num % i) == 0: print(num,"is not a prime number") print(i,"times",num//i,"is",num) break else: print(num,"is a prime number") # if input number is less than # or eq ual to 1, it is not prime else: print(num,"is not a prime number") Screenshot Input: Output: Result: Thus the above program has been executed successfully. Ex no: Name : Date: Reg. No: Make a simple calculator A im: To write a python program to make a simple calculator Program: def add(x, y): return x + y # This function subtracts two numbers def subtract(x, y): return x - y # This function multiplies two numbers def multiply(x, y): return x * y # This function divides two numbers def divide(x, y): return x / y print("Select operation.") print("1.Add") print("2.Subtract") print("3.Multiply") print("4.Divide"): # take input from the user choice = input("Enter choice(1/2/3/4): ") # ch eck if choice is one of the four options if choice in ('1', '2', '3', '4'): num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) if choice == '1': print(num1, "+", num2, "=", add(n um1, num2)) elif choice == '2': print(num1, " - ", num2, "=", subtract(num1, num2)) elif choice == '3': print(num1, "*", num2, "=", multiply(num1, num2)) elif choice == '4': print(num1, "/", num2, " =", divide(num1, num2)) # check if user wants another calculation # break the while loop if answer is no next_calculation = input("Let's do next calculation? (yes/no): ") if next_calculation == "no": break else: print("Invalid Input") Sample screenshot: Output: Result: Thus the above program has been executed successfully. Ex no: Name : Date: Reg. No: Find the Factoria l of a Number Aim: To write a python program to find the factorial of a number Program : Num = int(input("enter the number")) Factorial = 1 if Num < 0: print("Factorial does not exist for negative numbers") elif Num == 0: print("The factorial of 0 is 1") else: for i in range(1, Num + 1): Factorial = Factorial * i print("The factorial of",Num,"is",Factorial) Sample screenshot: Input: Output: Ex no: Name : Date: Reg. No: II) Python Program to Convert Decimal to Binary, Octal and Hexadecimal Aim: To Write a Python Program to Convert Decimal to Binary, Octal and Hexadecimal Program: dec = int(input("Enter an integer: ")) print("The decimal value of",dec,"is:") print(bin(dec),"in binary.") print(oct(dec),"in octal.") print(hex(dec),"in hexadecimal.") Sample Screenshot: Result: Thus the above program has been executed successfully. Ex no: Name : Date: Reg. No: Program to read and write text and numbers Aim: To write a python program to read and write text and numbers Program: f = open("sample.txt", "w") integer = 10 f.write(str(integer)) a="hello" f.write(str(a)) with open('sample.txt') as f: contents = f.read() print(contents) f.close() Screenshot: Input: Output: Result: Thus th e above program has been executed successfully.