This repository contains my journey through Python challenges on HackerRank, where I earned a 5-star rating in Python programming. Each solution demonstrates different aspects of Python programming, from basic syntax and data structures to advanced string manipulation, set operations, itertools, and algorithmic problem-solving. These solutions showcase Pythonic approaches and best practices.
HelloWorldWithPython.py- Basic print statement and program structurePythonIf-Else.py- Conditional statements with if-elif-else logicArithmeticOperators.py- Basic arithmetic operations (+, -, *)PythonDivision.py- Integer and float division (//)Loops.py- For loops with range and power operationsWriteaFunction.py- Function definition and leap year logicPrintFunctions.py- Print without newline using end parameter
Lists.py- List operations (insert, remove, append, sort, pop, reverse)Tuples.py- Tuple creation and hash functionListComprehensions.py- List comprehensions with multiple conditionsFindTheRunnerUpScore.py- Set operations and sortingNestedList.py- Nested lists and data inputFindingThePercentage.py- Dictionary creation and manipulation
SwapCase.py- Custom swapcase() implementationSplitStringAndJoin.py- split() and join() methodsWhatYourName.py- String concatenation and formattingMutations.py- String slicing and immutability conceptsFindAString.py- Substring counting with string slicingStringValidation.py- Character validation methods (isalnum, isalpha, isdigit, islower, isupper)TextAlignment.py- String alignment with rjust(), ljust(), center()TextWrap.py- textwrap module for text formattingDesignerDoorMat.py- Pattern printing with center() and string multiplicationStringFormating.py- Number base conversion (binary, octal, hex)AlphabetRangoli.py- Complex pattern generation with chr() and ord()Capitalize.py- Custom capitalization logic with character manipulationTheMinionGame.py- Substring generation and vowel/consonant counting
IntoductionToSets.py- Set creation and average calculationSymmetricDifference.py- difference() and union() operationsSetAdd().py- add() method for unique elementsSetUnion()Operation.py- union() for combining sets- [
Set .intersection()Operation.py](Set .intersection()Operation.py) - intersection() for common elements Set.difference()Operation.py- difference() for unique elementsSet.symmetric_difference()Operation.py- symmetric_difference() operationSetMutations.py- Set mutation methods (update, intersection_update, difference_update)TheCaptainRoom.py- Set operations for finding unique elementsCheckSubset.py- issubset() method for subset validationCheckStrictSuperset.py- issuperset() method for superset validation
Counter().py- Counter class for counting elementsDefaultDict.py- defaultdict for handling missing keysnamedtuple().py- namedtuple for structured dataOrderedDict().py- OrderedDict for preserving insertion orderWordOrder.py- OrderedDict application for word countingDequeOperations.py- deque operations for efficient queue operationsCompanyLogo.py- Counter with most_common() methodPilingUpCubes.py- deque for stack/queue simulation
CalendarModule.py- calendar module for day calculationTimeConversion.py- time formatting and conversion
Exceptions.py- Try-except blocks for error handlingIncorrectRegex.py- Regular expression validation with exception handling
Zipped.py- zip() function for parallel iterationAttractionEvaluator.py- eval() function for expression evaluationAnyorAll.py- any() and all() functions for boolean operationsginortS.py- Custom sorting with sorted() and key functions
MapandLambdaFunction.py- map() with lambda functionsFilterFunction.py- filter() function for conditional filteringReduceFunction.py- reduce() function for cumulative operations
DetectFloatingPointNumber.py- Regular expressions for number validationRe.split().py- re.split() for advanced string splittingGroupGroups&Groupdict.py- Regex groups and capturingRe.findall()&Re.finditer().py- Finding patterns with regexRe.start()&Re.end().py- Position finding with regexRegexSubstitution.py- re.sub() for pattern replacementValidatingRomanNumerals.py- Complex regex for Roman numeral validationValidatingPhoneNumbers.py- Phone number validation with regexValidatingEmailAddresses.py- Email validation using regexValidatingHTMLTags.py- HTML tag parsing with regexValidatingUID.py- UID validation with multiple regex conditionsValidatingCreditCardNumbers.py- Credit card number validationValidatingPostalCodes.py- Postal code validation with regexMatrixScript.py- Complex string manipulation with regex
XMLBasics.py- XML parsing with ElementTreeXMLToDict.py- Converting XML to dictionary structureXMLMaxDepth.py- Finding maximum depth in XML structure
StandardizePhoneNumbers.py- Decorators for data formattingDecoratorName.py- Function decorators and wrapper functionsDecoratorEmail.py- Email formatting with decorators
ArrayBasics.py- NumPy array creation and basic operationsShapeAndReshape.py- Array reshaping operationsTransposeAndFlatten.py- Matrix transpose and flatteningConcatenate.py- Array concatenation operationsZerosAndOnes.py- Creating arrays with zeros and onesEyeAndIdentity.py- Identity matrix creationArrayMath.py- Mathematical operations on arraysFloorCeilAndRint.py- Rounding operationsSumAndProd.py- Sum and product operationsMinAndMax.py- Finding minimum and maximum valuesMeanVarAndStd.py- Statistical operationsDotAndCross.py- Dot and cross product operationsInnerAndOuter.py- Inner and outer product operationsPolynomials.py- Polynomial operationsLinearAlgebra.py- Linear algebra operations
- Input/output with
input()andprint() - Arithmetic operators and expressions
- Conditional statements (if-elif-else)
- Loop structures (for, while, range)
- Function definition and return values
swapcase(),upper(),lower()for case manipulationsplit()andjoin()for string parsingreplace()for character substitution- String slicing with
[start:end:step] isalnum(),isalpha(),isdigit(),islower(),isupper()for validationrjust(),ljust(),center()for alignmentchr()andord()for character-ASCII conversionformat()for advanced string formatting
- Lists: Dynamic arrays with methods like
append(),insert(),remove(),sort(),pop(),reverse() - Tuples: Immutable sequences with
hash()function - Sets: Unordered collections with
add(),union(),intersection(),difference(),symmetric_difference() - Dictionaries: Key-value pairs for data storage and retrieval
- List comprehensions with nested loops and conditions
map(),filter(),reduce()for functional programmingzip()for parallel iterationany()andall()for boolean operationssorted()with custom key functions- Lambda functions for inline operations
- Generator expressions for memory efficiency
Counterfor counting elementsdefaultdictfor handling missing keysnamedtuplefor structured dataOrderedDictfor preserving insertion orderdequefor efficient queue operations
- Pattern matching with
re.match(),re.search(),re.findall() - String substitution with
re.sub() - Complex validation patterns
- Capturing groups and named groups
- Try-except blocks for error handling
- Specific exception catching
- Finally blocks for cleanup
- Function decorators for code enhancement
- Wrapper functions and functools
- Closure concepts and applications
- Array creation and manipulation
- Mathematical operations on arrays
- Statistical functions
- Linear algebra operations
- Broadcasting and vectorization
-
Clone the repository:
git clone https://github.com/Ak-Rajak/PythonPro-With-HackerRank.git cd PythonPro-With-HackerRank -
Run any solution:
python HelloWorldWithPython.py
-
Install required packages (for NumPy solutions):
pip install numpy
-
Example execution:
# From SwapCase.py def swap_case(s): result = "" for char in s: if char.isupper(): result += char.lower() elif char.islower(): result += char.upper() else: result += char return result s = input() result = swap_case(s) print(result)
| Category | Problems Solved | Difficulty | Key Concepts |
|---|---|---|---|
| Introduction | 7 | π’ Easy | Basic syntax, I/O, operators |
| Basic Data Types | 6 | π’ Easy | Lists, tuples, dictionaries |
| Strings | 14 | π‘ Medium | String methods, slicing, formatting |
| Sets | 13 | π‘ Medium | Set operations, mathematical sets |
| Collections | 8 | π΄ Hard | Counter, defaultdict, deque, OrderedDict |
| Date and Time | 2 | π‘ Medium | Calendar, time formatting |
| Errors and Exceptions | 2 | π‘ Medium | Try-except, error handling |
| Built-ins | 4 | π΄ Hard | zip, eval, any, all, sorted |
| Python Functionals | 3 | π΄ Hard | map, filter, reduce, lambda |
| Regex and Parsing | 17 | π΄ Hard | Pattern matching, validation |
| XML | 3 | π΄ Hard | XML parsing, ElementTree |
| Closures and Decorators | 3 | π΄ Hard | Decorators, wrapper functions |
| Numpy | 15 | π΄ Hard | Array operations, linear algebra |
- β Proficiency in Python syntax and semantics
- β String manipulation and pattern matching expertise
- β Data structure selection and usage (lists, sets, dicts, tuples)
- β Advanced collections and their applications
- β Regular expression mastery for pattern matching
- β Functional programming with map, filter, reduce
- β Exception handling and robust code design
- β Decorator patterns and code enhancement
- β NumPy for scientific computing
- β Algorithm design and implementation
- β Problem-solving with Pythonic approaches
- Input parsing and validation
- Type conversion and data transformation
- Statistical analysis and calculations
- Case conversion and validation
- Pattern generation and alignment
- Complex text manipulation
- Regular expression applications
- Arithmetic and algebraic calculations
- Statistical computations
- Linear algebra with NumPy
- Numerical analysis
- Iterative and recursive solutions
- Set theory operations
- Graph and tree algorithms
- Optimization techniques
- XML parsing and processing
- Email and phone number validation
- Credit card and postal code verification
- HTML tag processing
- HackerRank Profile: Ak-Rajak
- LinkedIn: Your LinkedIn Profile
- GitHub: Ak-Rajak
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to fork this repository and submit pull requests for any improvements or additional solutions! Contributions for code optimization or alternative Pythonic approaches are welcome.
