Skip to content

Instantly share code, notes, and snippets.

View sahasourav17's full-sized avatar
🎯
Focusing

Sourav Saha sahasourav17

🎯
Focusing
View GitHub Profile
@sahasourav17
sahasourav17 / cdf546A.c
Created August 6, 2018 11:34
codeforces 546A solution
#include<stdio.h>
int main()
{
int n , k ,w;
int i ,sum = 0;
int dollar;
scanf("%d %d %d",&k,&n,&w);
for(i = 1;i <= w;i++)
{
sum = sum + i*k;
@sahasourav17
sahasourav17 / qrcodegen.py
Last active August 12, 2021 04:19
This code is for generating QR code.It will take text or URL as input and generate QR code as output
import pyqrcode
def qrcode():
q = pyqrcode.create(input())
q.png('gen_qrcode.png',scale=7)
print('qrcode generated')
if __name__=='__main__':
qrcode()
#import needed libraries
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import numpy as np
import matplotlib.pyplot as plt
#set the hyper-parameters
learning_rate = 0.001
training_epochs = 1000
#Function to check two strings are anagrams or not
def anagrams(s1,s2):
"""
we first check if both strings have the same length
because if they're not it's impossible for them to
be anagrams.
"""
if len(s1) != len(s2):
from collections import Counter
def anagrams(s1,s2):
"""
As seen in method 2, we first check if both strings have the
same length because if they're not it's impossible for them
to be anagrams.
"""
if len(s1) != len(s2):
return False
def anagrams(s1,s2):
if len(s1) != len(s2):
return False
return sorted(s1) == sorted(s2)
#import uniform distribution
from scipy.stats import uniform
import seaborn as sns
import matplotlib.pyplot as plt
#taking random variables from uniform distribution
data = uniform.rvs(size = 10000,loc = 5,scale = 10)
#plotting the uniform data
ax = sns.distplot(data,
#importing required libraries
from scipy.stats import norm
import seaborn as sns
import matplotlib.pyplot as plt
#creating the normal distribution
data = norm.rvs(size=10000,loc=0,scale=1)
#plotting the data
ax = sns.distplot(data,
#importing required libraries
from scipy.stats import expon
import seaborn as sns
import matplotlib.pyplot as plt
#creating the exponential distribution
data = expon.rvs(loc=0,scale=10,size=10000)
#plotting the data
ax = sns.distplot(data,
#importing required libraries
from scipy.stats import binom
import seaborn as sns
import matplotlib.pyplot as plt
#creating the binomial distribution
data = binom.rvs(n=20,p=0.7,size=10000)
#plotting the data
ax = sns.distplot(data,