Skip to content

Instantly share code, notes, and snippets.

View gauryash's full-sized avatar
🎯
Focusing

Yash Gaur gauryash

🎯
Focusing
  • 04:26 (UTC +05:30)
View GitHub Profile
Dataset_link=https://techtfq.com/s/Olympics_data.zip
site_link= https://techtfq.com/blog/practice-writing-sql-queries-using-real-dataset
SQL Queries:
1. How many olympics games have been held?
Problem Statement: Write a SQL query to find the total no of Olympic Games held as per the dataset.
code - select count(distinct(games)) from olympic_table
@gauryash
gauryash / Compare the Triplets.py
Last active July 29, 2020 05:10
hacker_rank_Compare the Triplets_problem
"""
PROBLEM STATEMENT
Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty.
The rating for Alice's challenge is the triplet a = (a[0], a[1], a[2]), and the rating for Bob's challenge is the triplet b = (b[0], b[1], b[2]).
The task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1], and a[2] with b[2].
If a[i] > b[i], then Alice is awarded 1 point.
If a[i] < b[i], then Bob is awarded 1 point.
"""Write a program to print the sum of all the elements of an array of size N where N can be any integer between 1 and 100. """
N = input()
# Get the input
numArray = map(int, input().split())
sum_integer = 0
# Write the logic to add these numbers here
for number in numArray:
sum_integer += number
@gauryash
gauryash / Square Root (Integral).py
Created March 22, 2020 07:26
Given a number N, find its square root. You need to find and print only the integral part of square root of N.
'''Square Root (Integral)
Given a number N, find its square root. You need to find and print only the integral part of square root of N.
For eg. if number given is 18, answer is 4.
Input format :
Integer N
Output Format :
Square root of N (integer part only)
Sample Input 1 :
10
Sample Output 1 :
'''Write a program that asks the user for a number N and a choice C. And then give him the possibility to choose between computing the sum and computing the product of 1 ,..., N.
If user enters C is equal to -
1 : Print sum of 1 to N numbers
2 : Print product of 1 to N numbers
Any other number : print -1
Input format :
Line 1 : Integer N
Line 2 : Choice C (1 or 2)
Output Format :
Sum or product according to user's choice
"""MAKES TWENTY: Given two integers, return True if the sum of the integers is 20 or if one of the integers is 20. If not, return False¶
makes_twenty(20,10) --> True
makes_twenty(12,8) --> True
makes_twenty(2,3) --> False"""
def makes_twenty(*args):
if sum(args)==20:
return 'true'
else:
@gauryash
gauryash / loops.py
Created January 16, 2020 14:31
Hacker_Rank_Day_5:Loops
#Given an integer,n, print its first 10 multiples.
#Each multiple n x i (where 1<=i<=10)should be printed on a new line in the
#form: n x i = result.
#Input Format:
#A single integer, n .
#Constraints:
#2<=n<=20