Python

Python and MariaDB: How to access Maria Database with Python

Database table : Customer table with following columns. database.py :  Create database connection and close connection. # -*- coding: utf-8 -*- """ Created on Tue Jul 24 09:40:55 2018 @author: n0r0082 """ fro…

Python os module- File operations in Python using python os module

Python provides os module which can be used to perform File operations like - create, read, write and delete. Below program performs following operation - 1. Check for a directory and create if it does not exist 2. Create a file . 3. Write into fi…

Vector Arithmetic in Python : Dot product and Cross product

Write a sample program to perform Addition(+), Subtraction(-), Dot product,Cross product between two vectors. Also find angle between two vectors. from math import * class vector : def __init__ ( self , x, y, z): self . x = floa…

Operator overloading in python: Python Arithmetic on Complex numbers

Write a sample program to perform Addition(+), Subtraction(-), Multiplication(*),Division(/) between complex numbers. And also perform Mod (underRoot(Square(real)+square(imaginary))) of complex number.  from math import pow class complex : …

Simulate Unix GREP command in Python

Grep command  :- Grep searches the named input FILE's (or standard input if no files are named, or the file name - is given) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.takes 2 parameters "so…

Python: Using XOR operator find unique elements in array

Problem :- Consider an array of  integers, , where every element in  occurs exactly twice except for one unique element.Find and print the unique element. Input  :-  4 9 95 93 57 4 57 93 9 #Input array with 95 as unique element. Output :- 95 B…

Load More
That is All