This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by Ankur (https://github.com/ankdos) | |
require 'mechanize' # Importing the required library | |
mechanize = Mechanize.new # Creating the mechanize instance | |
starting_roll = XXXXXXX # Declaring the range of roll number to be parsed (put a valid roll no) | |
ending_roll = XXXXXXX | |
login_page = mechanize.get 'http://resultsarchives.nic.in/cbseresults/cbseresults2014/class12/cbse122014_total.htm' # The URL to be parsed | |
while starting_roll <= ending_roll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_prime(num) | |
i=2 | |
res = true | |
while i < num | |
if num % i == 0 | |
res = false | |
break | |
end | |
i+=1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Ankdos{ | |
static int count(char letter , String word ){ | |
int i = 0,counts = 0 ; | |
while(i<word.length()){ | |
if (letter == word.charAt(i) ){ | |
counts++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created By Ankdos | |
# Program to print random number between range without using inbuilt function | |
import datetime | |
def push (mins , maxs , ms) : | |
ran = gen_rand(0,maxs-mins) | |
ms = mins + ran | |
if ms > maxs : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CREATED BY ANKDOS | |
# A PROGRAM THAT TAKES Nth HIGHEST NUMBER (only n , not element) IN THE ARRAY AND RETURNS HOW MANY TIMES ITS REPEATING | |
def sort_dec (ar) : | |
swap_count = 0 | |
i = 0 | |
while True : | |
while i < len(ar)-1 : | |
if ar[i] < ar[i+1] : | |
temp = ar[i+1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Created By AnkDos(https://github.com/AnkDos) | |
#A decorator to validate function argument | |
def validate_inputs(func): | |
def validate(*args): | |
variables_value_map = dict(zip(func.__code__.co_varnames,args)) | |
for key, value in func.__annotations__.items(): | |
assert isinstance(variables_value_map[key],value),\ | |
'Invalid Attribute' | |
return func(*args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_func(a, b): | |
"""asserting every argument""" | |
assert isinstance(a, int) , "Invalid Attribute" | |
assert isinstance(b, str) , "Invalid Attribute" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dictionary_parser(dict_): | |
""" | |
Traversing through any type of dictionary wihout using recursion | |
Input any dict , Returns list of list of all key value pair in dict | |
SAMPLE : | |
:arg : { | |
"a": "b", | |
"c": "d", | |
"e": [ | |
{"aa": "bb"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import sys | |
import time | |
import os | |
class ConsoleQuiz: | |
"""""" | |
QUESTIONS = { | |
'01': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten(data): | |
flatten_dict = {} | |
def flat(data_, key, pkey=''): | |
if isinstance(data_, dict): | |
if data_ == dict(): | |
flatten_dict[f"{pkey}"] = data_ | |
for key, value in data_.items(): | |
key_fmt = [pkey, key] | |
if pkey == '': | |
key_fmt = [key] |
OlderNewer