Update appNew update is available. Click here to update.
About
I am a business analyst and data analyst. Skilled in Python, SQL, Machine Learning, BI tools. I build E-Commerce Sales Dashboard that optimizes different cities sales. Positive about exploring new te...
United College of Education BBA BCA BJMC Top College of IP University Delhi 2021
My Stats
EXP gained
yellow-spark
5280
Level
6 (Specialist)
Community stats
Discussions
1
Upvotes
0
Know more
208
Total problems solved
197
Easy
10
Moderate
1
Hard
0
Ninja
Dec Dec Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov

Current streak:

0 days

Longest streak:

3 days

Less

More

Achievements
1
Samurai
Guided path
Basics of python
Discussions
Print Name and age - PYTHON - 100% Working
Interview problems

from os import *

from sys import *

from collections import *

from math import *

 

class Person:

 

    def __init__(self,name,age):

 

        self.name=name

        self.age=age

    def __str__(self):

 

        return "The name of the person is {} and the age is {}.".format(self.name,self.age)

 

 #create your class here

 

name=input()

age=int(input())

n=Person(name,age)

print(n)

 

profile
faizal14
Published On 22-Feb-2023
173 views
0 replies
0 upvotes
Fraction Class - Python - 100# Working
Interview problems
from os import *
from sys import *
from collections import *
import math

class Fraction:
    #Create your fraction class here.
    def __init__(self, num,den):
        self.num = num
        self.den = den

    def lcm(self, a, b):
        return abs(a*b) // math.gcd(a, b)        
        
    def __str__(self):
        return "{}/{}".format(self.num,self.den)
    
    def __add__(self,obj):
        temp = Fraction(self.num,self.den)
        a = self.lcm(self.den,obj.den)
        b = (self.num * (a//self.den)) + (obj.num * (a//obj.den))
        self.num = temp.num = b
        self.den = temp.den = a
        return temp
    
    def __mul__(self,obj):
        temp = Fraction(self.num,self.den)
        a = self.num * obj.num
        b = self.den * obj.den
        self.num = temp.num = a
        self.den = temp.den = b
        return temp
    
    def plus(self,obj):
        return self + obj
    
    def multiply(self,obj):
        return self * obj
    
    def simplify(self):
        a = math.gcd(self.num,self.den)
        self.num //= a
        self.den //= a
        return self
    
    def Print(self):
        print(self)

#Driver code goes here.
num1,den1 = list(map(int,input().split()))
fr1 = Fraction(num1,den1)
reps = int(input())
for _ in range(reps):
    op,num2,den2 = list(map(int,input().split()))
    fr2 = Fraction(num2,den2)
    if op == 1:
        fr1.plus(fr2)
        fr1.simplify()
        fr1.Print()
    elif op == 2:
        fr1.multiply(fr2)
        fr1.simplify()
        fr1.Print()
profile
faizal14
Published On 22-Feb-2023
176 views
0 replies
0 upvotes
Remove character - python - 100% Working
Interview problems

from sys import stdin

 

def removeAllOccurrencesOfChar(string, ch) :

    n = len(string)

    new_str = ""

    for i in range(n):

        if ch!=string[i]:

            new_str+=string[i]

    string = new_str

    return string

 

#main

string = stdin.readline().strip()

ch = stdin.readline().strip()[0]

ans = removeAllOccurrencesOfChar(string, ch)

print(ans)

profile
faizal14
Published On 22-Feb-2023
76 views
0 replies
0 upvotes
Reverse Each Word - Python - 100% Working
Interview problems

from sys import stdin

 

def reverseEachWord(string):

    new_str=string.split()

    ans=""

    for i in range(len(new_str)):

        temp=new_str[i]

        temp = temp[::-1]

        ans+=temp+" "

    string=ans

    return string

    

#main

string = stdin.readline().strip()

ans = reverseEachWord(string)

print(ans)

 

profile
faizal14
Published On 22-Feb-2023
44 views
0 replies
0 upvotes
Check Permutation - Python - 100% Working
Interview problems

def isPermutation(string1, string2) :

    

    #Your code goes here

    if sorted(string1)==sorted(string2):

        return True

    else:

        return False

 

#main

string1 = input()

string2 = input()

 

ans = isPermutation(string1, string2)

 

if ans :

    print('true')

else :

    print('false')

 

profile
faizal14
Published On 22-Feb-2023
194 views
0 replies
0 upvotes
K'th smallest/largest element in an array - 100% WORKING
Interview problems

def kthSmallestLargest(arr,k):

    

    #Your code goees here.

    arr = list(set(arr))    

    if len(arr)<k:        

        return -1,-1    

    else:        

        

        return arr[k-1],arr[len(arr)-k]

 

                                               

 

#Driver's code

t = int(input())

 

while t > 0:

    

    n,k = map(int,input().split())

    arr = [int(i) for i in input().split()]

    small,large = kthSmallestLargest(arr,k)

    print(large,small)

    

    t -= 1

profile
faizal14
Published On 22-Feb-2023
236 views
0 replies
0 upvotes
Print Name and Age
Interview problems

MY CODE

name = input()

age - int(input())

print("The name of the person is", name, "and the age is", age)

 

 

why is this getting errors??????????????

profile
faizal14
Published On 21-Feb-2023
94 views
1 replies
0 upvotes