0% found this document useful (0 votes)
7 views1 page

Python Socket Client for CGPA Report

The document contains a Python script for a client application that connects to a server via TCP socket. It prompts the user for their student ID, number of subjects, and for each subject, it requests credit hours and marks obtained. Finally, it receives and prints a CGPA report before closing the connection.

Uploaded by

Ayesha A. Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Python Socket Client for CGPA Report

The document contains a Python script for a client application that connects to a server via TCP socket. It prompts the user for their student ID, number of subjects, and for each subject, it requests credit hours and marks obtained. Finally, it receives and prints a CGPA report before closing the connection.

Uploaded by

Ayesha A. Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import socket

def start_client():
client = [Link](socket.AF_INET, socket.SOCK_STREAM)
[Link](("[Link]", 12345))

# Receive welcome message


print([Link](1024).decode())

# Enter student ID
student_id = input("Enter your student ID: ")
[Link](student_id.encode())

# Enter number of subjects


num_subjects = input("Enter number of subjects: ")
[Link](num_subjects.encode())

for i in range(int(num_subjects)):
credit_hours = input(f"Enter credit hours for subject {i+1}: ")
[Link](credit_hours.encode())

marks = input(f"Enter marks obtained for subject {i+1} (out of 100): ")
[Link]([Link]())

# Receive CGPA report


print([Link](4096).decode())

[Link]()

if __name__ == "__main__":
start_client()

You might also like