Wednesday, January 11, 2023

Data visualization using Pandas, Nympy, Matplotlib.pyplot and Seaborn in Jupyter Notebook

 Using sample dataset from Kaggle > Bankloan credit_train.csv:

First importing libraries and modules:


Read the csv file using Pandas and read the 1st 4 rows:



Get total numbers of rows and column, dropping duplicates, and describing the datasets:



using seaborn regplot to predict the data:



using relplot:



Using seaborn lmplot:



Using pairplot:




Wednesday, December 14, 2022

Random Password Generator using Python

 Hello! Today we will be making a randon password generator using Python.

The program will accept an integer length of password to be generated.

Code:

import random

# Function to generate a password

def generate_password(length):

   password = ""

  # List of characters to choose from

  chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+-=[]{};:'\"<>,.?/"

  

  # Generate a password of the specified length

  for i in range(length):

    password += random.choice(chars)

    

  # Return the generated password

  return password


# Test the password generator

print(generate_password(8))  # Output: eg. "w4V6Bh8#"

print(generate_password(12)) # Output: eg. "a3!fB5gL7@m9D"

print(generate_password(16)) # Output: eg. "g5J7Fp3#h4V1@m6D8"


This program defines a "generate_password()" function that takes a password length as an input and returns a randomly generated password of that length. The password is generated by choosing random characters from a list of allowed characters. You can modify the list of allowed characters to suit your needs.

Sunday, December 11, 2022

Challenges - Cartesian Product

 In this challenge we will find the cartesian product of 2 sets of numbers:

What is cartesian product?

It is the product of two sets: the product of set X and set Y is the set that contains all ordered pairs (x,y) for which x belongs to X and y belongs to Y.

We will use Pythons itertools module and import its product method to get its cartesian product.

The task:

The solution: