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
5280
Level
6 (Specialist)
Community stats
Discussions
1
0
Know more
208
Total problems solved
197
Easy
10
Moderate
1
Hard
0
Ninja

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)

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

class Fraction:
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)

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()``````
faizal14
Published On 22-Feb-2023
176 views
0 replies
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

ans = removeAllOccurrencesOfChar(string, ch)

print(ans)

faizal14
Published On 22-Feb-2023
76 views
0 replies
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

ans = reverseEachWord(string)

print(ans)

faizal14
Published On 22-Feb-2023
44 views
0 replies
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')

faizal14
Published On 22-Feb-2023
194 views
0 replies
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

faizal14
Published On 22-Feb-2023
236 views
0 replies
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??????????????

faizal14
Published On 21-Feb-2023
94 views
1 replies