0% found this document useful (0 votes)
11 views6 pages

5th Question

Uploaded by

petermj2222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

5th Question

Uploaded by

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

Enrollment Number : EA2331201010 Name of student :

Date : 28-11 -2024 Subject Code :


V20UDS301
Name of Subject: Python Programming

Aim:

Write a python programming to display basic system information, including the operation
system, CPU details, memory usage and disk space.

Procedure Steps/Algorithm:

1. Operating system information

2. CPU information

3. Memory information

4. Disk space information

Program:
Code : import platform

import psutil

import os

def display_system_info():

# operating system Information

print(f"Operating System: {platform.system()} {platform.release()}")

print(f"OS Version : {platform.version()}")

print(f"Machine Type: {platform.machine()}")

print(f"Processor: {platform.processor()}")

# CPU information

print("\nCPU Information:")

cpu_count = psutil.cpu_count(logical=False) #Physical cores

cpu_logical_count = psutil.cpu_count(logical=True) #Logical cores(threads)

cpu_freq = psutil.cpu_freq()

print(f"physical cores : {cpu_count}")


print(f"Logical cores (threads): {cpu_logical_count}")

print(f"CPU Frequency: {cpu_freq.count}MHz")

# memory info

print("\nMemory Information:")

memory = psutil.virtual_memory()

print(f"Total Ram: {memory.total / (1024 ** 3):.2f} GB")

print(f"Available Ram: {memory.available / (1024 ** 3):.2f} GB")

print(f"Used Ram: {memory.used / (1024 ** 3):.2f} GB")

print(f"Memory Usage: {memory.percent}%")

# Disk space info

print("\nDisk space Information:")

disk = psutil.disk_usage('/')

print(f"Total Disk Space: {disk.total / (1024 ** 3):.2f} GB")

print(f"Used Disk Space: {disk.used / (1024 ** 3):.2f} GB")

print(f"Free Disk Space: {disk.free / (1024 ** 3):.2f} GB")

print(f"Disk Usage: {disk.percent}%")

if __name__ == "__main__":

display_system_info()

Output:
PS C:\Users \Downloads\example> python python.py

Operating System: Windows 11

OS Version : 10.0.22631

Machine Type: AMD64

Processor: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel

CPU Information:

physical cores : 4

Logical cores (threads): 8

CPU Frequency: <built-in method count of scpufreq object at 0x000001D4DB9D6E30>MHz

Memory Information:

Memory Information:

Total Ram: 7.71 GB

Available Ram: 1.51 GB

Memory Information:

Memory Information:

Total Ram: 7.71 GB

Available Ram: 1.51 GB


Used Ram: 6.19 GB

Memory Usage: 80.4%

Memory Information:

Total Ram: 7.71 GB

Available Ram: 1.51 GB

Used Ram: 6.19 GB

Memory Information:

Total Ram: 7.71 GB

Available Ram: 1.51 GB

Memory Information:

Total Ram: 7.71 GB

Available Ram: 1.51 GB

Memory Information:

Memory Information:

Memory Information:

Memory Information:

Memory Information:

Memory Information:

Total Ram: 7.71 GB

Total Ram: 7.71 GB

Available Ram: 1.51 GB

Used Ram: 6.19 GB

Memory Usage: 80.4%

Disk space Information:

Total Disk Space: 222.82 GB

Used Disk Space: 160.17 GB

Free Disk Space: 62.65 GB

Total Disk Space: 222.82 GB

Used Disk Space: 160.17 GB

Free Disk Space: 62.65 GB


Used Disk Space: 160.17 GB

Free Disk Space: 62.65 GB

Free Disk Space: 62.65 GB

Disk Usage: 71.9%

Result:

Thus the program to perform display basic system information, including the operation
system, CPU details, memory usage and disk space is written and executed successfully.

You might also like