Python Code Snippets for Data Science and AI

# **Program 1:

NumPy

Array Operations**
import numpy as np
arr=np.Array([[1,2,3],[4,5,6],[7,8,9]])
print(“Sum of all columns:”,np.
sum(arr,axis=0))
print(“Product of all rows:”,np.Prod(arr,axis=1))
print(“Last two rows and columns:\n”,arr[1:,1:])
arr2=np.Array([[9,8,7],[6,5,4],[3,2,1]])
print(“Element-wise addition:\n”,arr+arr2)
.
.

# **Program 2: Vowel Frequency in Each Word**
sentence=input(“Enter a sentence in lowercase: “)
vowels=’aeiou’
for w in sentence.Split():
    print(f”{w}: {sum(w.Count(v) for v in

Read More

Key Concepts in Political Philosophy: From Mill to Marx

John Stuart Mill: Life and Philosophy

Life and Works

  • Born: May 20, 1806, in London, England.
  • Philosopher and Economist: Mill was a prominent philosopher and economist who contributed to the fields of ethics, politics, and economics.
  • Major Works: “On Liberty”, “Utilitarianism”, “The Subjection of Women”.

Philosophical Contributions

  • Utilitarianism: Mill was a key figure in the development of utilitarianism, which aims to maximize overall happiness and well-being.
  • Liberty and Individuality: Mill advocated
Read More

Core Concepts of Money, Payments, and Interest Rates

What is Money?

Money is anything generally accepted as payment for goods and services (G&S) or in the settlement of debts.

Key Functions of Money

  • It acts as a medium of exchange.
  • It is a unit of account.
  • It is a store of value.
  • It offers a standard of deferred payment.

Money, Income, and Wealth

  • Money: A component of wealth.
  • Income: A person’s earnings over a period of time.
  • Wealth: The sum of a person’s assets minus their liabilities.

Transaction Costs and Specialization

Transaction costs are the costs

Read More

Core Concepts of Neural Anatomy and Signaling

Nervous System Structure and Function

The Nervous System (NS) maintains body temperature, monitors, integrates, and responds to information in the environment.

Divisions of the Nervous System

  • Central Nervous System (CNS): Includes the brain and spinal cord.
  • Peripheral Nervous System (PNS): Includes cranial and spinal nerves.

PNS Divisions

  1. Sensory (Afferent) Division: Conveys impulses to the CNS.
  2. Motor (Efferent) Division: Conveys impulses from the CNS.
    • Somatic (Voluntary) System: Serves skeletal muscles.
Read More

Power Supply Units and Electronic Oscillator Circuits

Power Supply Units (PSUs) and Operation

Defining Power Supply Units (PSUs)

A PSU is an electronic device capable of transforming the AC voltage from the industrial distribution network (50 Hz) into voltage suitable for powering electronic devices.

Switched Power Supplies vs. Linear Sources

A Switched Power Supply is an electronic device that converts electrical energy by switching transistors. While a voltage regulator uses transistors biased in the active region of amplification, switching power supplies

Read More

अर्थशास्त्र आणि बँकिंग: प्रमुख संकल्पना, धोरणे व मर्यादा

बँक दर धोरणावरील मर्यादा (Limitations of Bank Rate Policy)

बँक दर धोरण (Bank Rate Policy) प्रभावी ठरण्यातील प्रमुख अडचणी खालीलप्रमाणे आहेत:

  1. अनौपचारिक वित्त व्यवस्था: भारतासारख्या देशांमध्ये अनेक व्यवहार अनौपचारिक वित्त
Read More

Clinical Allergy and Immunology: Key Diseases, Diagnosis, and Management Protocols

Urticaria (Hives)

  • Related Condition: Angioedema.
  • Manifests as rashes all over the body.
  • Skin Layers Involved: Upper layers of the dermis.
  • Itching Mechanism: H1 receptor activation by histamine.
  • Main Symptoms of Hives: Local edema, erythema, and itching.
  • Duration of Exposure (Individual Lesion): Typically 24 to 48 hours.
  • Can be confused with urticarial vasculitis.
  • Chronic Spontaneous Urticaria (CSU): Diagnosed if symptoms persist for more than 6 weeks.
  • CSU Rash Characteristics: Size and shape of the rashes
Read More

Financial Instruments and Business Structures: Debentures, Shares, and Company Types

Types of Debentures

Debentures are long-term financial instruments issued by companies to raise funds from investors. They are a form of debt and come with a fixed interest rate. Debentures can be classified into different types based on convertibility, security, tenure, and transferability.

Based on Convertibility

  1. Convertible Debentures: These can be converted into equity shares after a specified period. They are further classified as:
    • Fully Convertible Debentures (FCDs): The entire debenture amount
Read More

Essential English Language Practice and Global Topics Review

The Bermuda Islands

Facts and Context

  • Statement 1: False.
  • Phrase 1: Spanish fled.
  • Statement 2: False.
  • Phrase 2: Mr. Allen’s glory.

Vocabulary Pairs

  • trapped / snared
  • hungry / starving
  • loss or destruction / Shipwreck
  • initiated / launched

Grammar and Usage Corrections

  • Far From → Far from
  • its since → its
  • to visit had → had visited
  • are inhabitted is culled → is inhabited

Rhinoceros Lake

Facts and Context

  • Statement 1: False.
  • Phrase 1: A good artist.
  • Statement 2: True.
  • Phrase 2: Excitedly Beebe Lake.

Vocabulary Pairs

  • wrong
Read More

Java Implementation of DSS Signing and Cipher Cryptanalysis

Digital Signature Standard (DSS) Client Implementation

This Java class, DssClient, demonstrates the generation of a Digital Signature Standard (DSS) signature and subsequent transmission of the parameters to a verification server via a socket connection.

1.1. DssClient Class Structure and Signature Generation

The dssSign method calculates the signature components r and s, along with the public key y, based on input parameters (primes p, q, generator g, private key x, message hash H(m), and random nonce

Read More