Skip to content

Instantly share code, notes, and snippets.

View meet100ni's full-sized avatar

Meet Soni meet100ni

View GitHub Profile
@meet100ni
meet100ni / HackerRank Python If-Else Solution
Last active May 13, 2020 06:08
If-Else HackerRank Challenge
#!/bin/python3
import math
import os
import random
import re
import sys
@meet100ni
meet100ni / Arithmetic Operators HackerRank Solution
Created May 13, 2020 06:12
HackerRank Arithmetic Operators Challenge Solution
if __name__ == '__main__':
a = int(input())
b = int(input())
print(a + b)
print(a - b)
print(a * b)
@meet100ni
meet100ni / Python: Division HackerRank Solution
Created May 13, 2020 06:17
Python: Division HackerRank Solution
if __name__ == '__main__':
a = int(input())
b = int(input())
print(a // b)
print(a / b)
@meet100ni
meet100ni / Loops HackerRank Solution
Created May 13, 2020 06:23
Print Table of given number in python using For Loop
if __name__ == '__main__':
n = int(input())
for i in range(n):
print(i * i)
@meet100ni
meet100ni / Write a Function: HackerRank Solution
Created May 13, 2020 06:38
Write a Function: HackerRank Solution to find leap year
def is_leap(year):
leap = False
return year % 4 == 0 and (year % 400 == 0 or year % 100 != 0)
year = int(input())
print(is_leap(year))
@meet100ni
meet100ni / Print Function HackerRank Solution
Created May 13, 2020 12:23
Print Function : HackerRank Solution
if __name__ == '__main__':
n = int(input())
for i in range(n+1):
if i==0:
continue
print(i, end="")
@meet100ni
meet100ni / Print Function HackerRank Solution
Created May 13, 2020 12:23
Print Function : HackerRank Solution
if __name__ == '__main__':
n = int(input())
for i in range(n+1):
if i==0:
continue
print(i, end="")
@meet100ni
meet100ni / Set .symmetric_difference() Operation HackerRank Solution
Created May 13, 2020 13:00
Set .symmetric_difference() Operation HackerRank Solution
# Enter your code here. Read input from STDIN. Print output to STDOUT
"""
For more understanding: https://www.programiz.com/python-programming/methods/set/symmetric_difference
"""
# '_' is a variable and input().split() will separate input from the console
_, a = input(), set(input().split())
_, b = input(), set(input().split())
print(len(a.symmetric_difference(b)))
@meet100ni
meet100ni / Set Mutations HackerRank Solution
Created May 13, 2020 13:10
Set Mutations HackerRank Solution
if __name__ == '__main__':
(_, A) = (int(input()),set(map(int, input().split())))
B = int(input())
for _ in range(B):
(command, newSet) = (input().split()[0],set(map(int, input().split())))
getattr(A, command)(newSet)
print (sum(A))
@meet100ni
meet100ni / The Captain's Room HackerRank Solution
Created May 13, 2020 13:17
The Captain's Room HackerRank Solution
# Enter your code here. Read input from STDIN. Print output to STDOUT
K = int(input())
set_S = set()
sumlist_S = 0
for i in input().split():
I = int(i)
set_S.add(I)
sumlist_S += I