Skip to content

el2e10/pythonicway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PythonicWay

Life is short, use Python!

Getting Started

What does pythonic mean? ~ Stack Overflow:

  • Exploiting the feature of the Python language to produce code that is clear, concise, and maintainable.
  • Code that doesn't just get the syntax right but that follows the conventions of the Python community and uses the language in the way it is intended to be used.

The repository contains two directories:

  • Normal way : Python programs written in a way that you'd usually see in other common languages such as Java/C++.

  • Pythonic way: The same programs as above, but redesigned to be more "pythonic".

The Zen of Python (PEP20), Tim Peters:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one — and preferably only one — obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

Contributing

Please check the contribution guidelines for more information.

List of Completed Programs

Serial No. Program Normal Way Pythonic Way
1 Array Iteration arrayIteration.py arrayIteration.py
2 Reverse Array arrayReverse.py arrayReverse.py
3 Array Element Check checkElementExist.py checkElementExist.py
4 Check Empty Array checkEmpty.py checkEmpty.py
5 Construct Empty Array constructNewArrayWithoutAnElement.py constructNewArrayWithoutAnElement.py
6 Count Elements countElement.py countElement.py
7 Count Of Elements countOfElements.py countOfElements.py
8 Square Elements(Array) findSquareOfEveryElementInArray.py findSquareOfEveryElementInArray.py
9 Map Two Lists mapTwoLists.py mapTwoLists.py
10 Open File openFile.py openFile.py
11 Remove Duplicate removeDuplicate.py removeDuplicate.py
12 Replace Element(Array) replaceArrayElement.py replaceArrayElement.py
13 Reverse String reverseString.py reverseString.py
14 Shorthand Condition shorthandCondition.py shorthandCondition.py
15 Swapping Variables swappingVars.py swappingVars.py
16 Frequency of Words wordFrequency.py wordFrequency.py
17 Print String N Times printStringNTimes.py printStringNTimes.py
18 Transpose Of a Matrix transposeMatrix.py transposeMatrix.py
19 Calculate Cartesian Product cartesianProduct.py cartesianProduct.py
20 Switch Key and Value of Map dictKeyValueSwitch.py dictKeyValueSwitch.py
21 Key of Max Dictionary Value keyOfMaxDictVal.py keyOfMaxDictVal.py
22 Unpacking Arguments unpackVariables.py unpackVariables.py
23 Nested List into one List nestedListIntoOneList.py nestedListIntoOneList.py
24 Double the Even items in a List doubleEvenItems.py doubleEvenItems.py
25 Capitalize every word in a sentance capitalizeWordsInSentance.py capitalizeWordsInSentance.py
26 Check if a word is an anagram checkAnagram.py checkAnagram.py
27 Count the number of characters in a string countOfSpecificCharaters.py countOfSpecificCharaters.py
28 Unpacking different iterables using * unpackIterables.py unpackIterables.py

Contributions are welcome

About

A repo containing programs that are written in both normal and pythonic way.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages