Comp Assignment
Comp Assignment
In this report, we explore the field of Data Science and its significance in today's data-driven
QUESTION 1
In this report, we explore the field of Data Science and its significance in today's data-driven
world. We begin by defining Data Science and providing an overview of the Python libraries
commonly used in this field. Furthermore, we present ten real-world applications of Data
Science and delve into two specific applications to showcase the impact and potential of this
rapidly growing field.
1. NumPy - Numerical Python: Provides powerful mathematical functions and tools for
working with arrays and matrices.
2. Pandas: Offers data manipulation and analysis capabilities, including data cleaning,
transformation, and exploration, using powerful data structures such as Data Frames.
3. Matplotlib: A versatile plotting library for creating a wide range of static, animated, and
interactive visualizations.
4. Seaborn: Built on top of Matplotlib, Seaborn provides a higher-level interface for creating
statistical visualizations with less code.
5. Scikit-learn: Offers a comprehensive set of machine learning algorithms and tools for
tasks such as classification, regression, clustering, and dimensionality reduction.
6. TensorFlow: A popular library for implementing and deploying deep learning models,
enabling efficient computation on large-scale neural networks.
7. Keras: A high-level deep learning API that runs on top of TensorFlow, simplifying the
process of building and training neural networks.
8. PyTorc: Another powerful deep learning library that provides dynamic computation graphs
and advanced functionality for building and training neural networks.
9. Natural Language Toolkit (NLTK): A library for working with human language data,
offering various tools and resources for tasks such as tokenization, stemming, tagging, and
parsing.
10. OpenCV: A computer vision library that provides a wide range of functions and
algorithms for image and video processing, object detection, and recognition.
Image Recognition: Data Science enables image recognition and object detection in fields
such as autonomous vehicles, surveillance systems, and medical imaging, aiding in diagnosis
and decision-making.
Energy Consumption Optimization: Data Science can analyse energy usage patterns to
identify inefficiencies, optimize energy consumption, and develop strategies for sustainable
energy management.
1. Fraud Detection:
Fraud is a significant concern for financial institutions and e-commerce platforms. Data
Science plays a crucial role in detecting and preventing fraudulent activities by analysing
large volumes of transactional data. Machine learning algorithms can identify patterns,
anomalies, and suspicious behaviour in real-time, enabling organizations to take immediate
action. Features such as transaction amount, location, time, and customer behaviour can be
used to build predictive models that flag potentially fraudulent transactions. By leveraging
Data Science techniques, organizations can reduce financial losses, protect customers, and
maintain trust in their platforms.
2. Healthcare Analytics:
Data Science has transformed the healthcare industry by enabling advanced analytics on vast
amounts of patient data. Machine learning algorithms can analyse electronic health records
(EHRs), medical imaging data, and genetic information to identify patterns and make
predictions. This aids in disease diagnosis, treatment planning, drug discovery, and clinical
decision-making. Data Science also plays a critical role in public health by analysing
population-level data to detect disease outbreaks, predict the spread of infectious diseases,
and allocate resources efficiently. By leveraging the power of Data Science, healthcare
providers can improve patient outcomes, personalize treatments, and enhance overall
healthcare delivery.
QUESTION 2
a. Algorithm Design:
1. Create a class called Account.
2. Initialize the account balance to 0 in the class constructor.
3. Implement the Deposit() method to take an amount as input and add it to the account
balance.
4. Implement the Withdraw() method to take an amount as input and subtract it from the
account balance.
5. Implement the Balance() method to return the current account balance.
b. Implementation in Python
class BankAccount:
def __init__(self):
self.balance = 0
def balance_check(self):
print(f"Current balance: ${self.balance}")
account = BankAccount()
account.balance_check() # Current balance: $0
account.deposit(1000)
account.balance_check()
account.withdraw(500)
account.balance_check()
account.withdraw(1000)
account.deposit(-200)
c. Discussion of Results:
The program defines a class called Account to simulate banking operations. The `deposit`
method allows the user to add money to their account, the `withdraw` method allows them to
withdraw money if they have sufficient balance, and the `balance` method returns the current
account balance.
When the program is executed, it creates an instance of the Account class. Initially, the
balance is 0. It then performs some operations, such as depositing 1000 units, withdrawing
500 units (which is successful), and attempting to withdraw 700 units (which fails due to
insufficient balance).
The program prints the current balance after each operation. This helps to verify that the
operations are executed correctly and the balance is updated accordingly.
Output:
{10: 'Ram', 20: 19, 30: 87.81}
3.2
Code:
number = int(input("Enter a number: "))
while number >= 0:
print(number)
number -= 1
Output:
Enter a number: 5
5
4
3
2
1
0
ACKNOWLEDGMENT: