Hackerrank String Formatting solution in python | python question solution

Given an integer, , print the following values for each integer  from  to :DecimalOctalHexadecimal (capitalized)BinaryFunction DescriptionComplete the print_formatted function in the editor below.print_formatted has the following parameters:int number: the maximum value to printPrintsThe four values must be printed…

Continue ReadingHackerrank String Formatting solution in python | python question solution

HackerRank Compress the String! solution in python | python question solution

In this task, we would like for you to appreciate the usefulness of the groupby() function of itertools . To read more about this function, Check this out .You are given a string . Suppose a character…

Continue ReadingHackerRank Compress the String! solution in python | python question solution

HackerRank Collections.deque() solution in python | python problem solution

collections.deque()A deque is a double-ended queue. It can be used to add or remove elements from both ends.Deques support thread safe, memory efficient appends and pops from either side of the deque…

Continue ReadingHackerRank Collections.deque() solution in python | python problem solution

HackerRank Set .discard(), .remove() & .pop() solution in python | python Question Solution

.remove(x)This operation removes element  from the set.If element  does not exist, it raises a KeyError.The .remove(x) operation returns None.Example>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9])>>> s.remove(5)>>> print sset([1, 2, 3, 4,…

Continue ReadingHackerRank Set .discard(), .remove() & .pop() solution in python | python Question Solution

HackerRank itertools.combinations_with_replacement() solution in python

itertools.combinations_with_replacement(iterable, r)This tool returns  length subsequences of elements from the input iterable allowing individual elements to be repeated more than once.Combinations are emitted in lexicographic sorted order. So, if the input iterable…

Continue ReadingHackerRank itertools.combinations_with_replacement() solution in python

HackerRank Set .add() problem solution in python | python Question solution

If we want to add a single element to an existing set, we can use the .add() operation.It adds the element to the set and returns 'None'.Example>>> s = set('HackerRank')>>> s.add('H')>>> print…

Continue ReadingHackerRank Set .add() problem solution in python | python Question solution

HackerRank Incorrect Regex solution in python | python question solution

   You are given a string . Your task is to find out whether  is a valid regex or not. Input Format The first line contains integer , the number of test cases. The next  lines…

Continue ReadingHackerRank Incorrect Regex solution in python | python question solution

HackerRank itertools.combinations() solution in python |python question solution

 itertools.combinations(iterable, r)This tool returns the  length subsequences of elements from the input iterable.Combinations are emitted in lexicographic sorted order. So, if the input iterable is sorted, the combination tuples will be…

Continue ReadingHackerRank itertools.combinations() solution in python |python question solution

HackerRank Symmetric Difference solution in python | python question solution

ObjectiveToday, we're learning about a new data type: sets.ConceptIf the inputs are given on one line separated by a character (the delimiter), use split() to get the separate values in the form of…

Continue ReadingHackerRank Symmetric Difference solution in python | python question solution