The stern module wants to show how easy and understandable Python syntax is
Project description
stern
stern is a free and open-source library by developer saivan
We need your help to make stern the best it can be! New contributors are welcome.
Installation
pip install stern
Examples Programs
Computing the difference between creation Python and PyPI:
import stern
def sumAB(a,b):
return a - b
print(sumAB(2003, 1991))
Written five times Hello beautiful world of programming!:
import stern
def SealN():
n=5
string="Hello beautiful world of programming! "
print(string * n)
SealN()
Flip the line to the other side:
import stern
def flip():
a = "stern"
print(a[::-1])
flip()
Moving x and y:
import stern
def IPS():
x = 91
y = 56
print(x,y)
x, y = y, x
print(x,y)
IPS()
Case of Letters:
import stern
def letters():
s = "sTeRn"
print(s.lower())
print(s.upper())
letters()
Spelling a word:
import stern
def listletters():
s = "stern"
print(list(s))
listletters()
Unique or NOT unique list:
import stern
def unique():
x = [1,9,9,1]
if(len(x) == len(set(x))):
print("The list is unique")
else:
print("The list is NOT unique")
unique()
For Else construct:
import stern
def forelse():
numbers = [2,4,6,8,1]
for number in numbers:
if number % 2 == 1:
print(number)
break
else:
print("No odd numbers")
forelse()
Difference between == u is:
import stern
def difference():
first = [1,2,3]
second = [1,2,3]
print(first == second)
print(first is second)
third = first
print(first is third)
difference()
Removing duplicates:
import stern
def duplicates():
list_numbers = [20,22,24,26,28,28,20,30,24]
print('Before:',list_numbers)
list_numbers = list(set(list_numbers))
print('After:',list_numbers)
duplicates()
Exchanging Values with Tuples:
import stern
def EVT():
a, b = 1, 2
print(a, b)
a, b = b, a
print(a, b)
EVT()
String Concatenation:
import stern
def StringConcatenation():
a = ["stern", "-", "is good", "module."]
print(" ".join(a))
StringConcatenation()
Dictionary and set generators:
import stern
def DictionaryGenerators():
S = {i**2 for i in range(10)}
D = {i: i**2 for i in range(10)}
print(S)
print(D)
DictionaryGenerators()
Output with print:
import stern
def Output():
for part in ["stern ", "is ", "good", "\n"]:
print(part, end='')
Output()
Finding the Most Duplicate Items in a List:
import stern
def FMDIL():
a = [1, 2, 3, 1, 2, 3, 2, 2, 4, 5, 1]
print(max(set(a), key=a.count))
FMDIL()
Kwargs:
import stern
def Kwargs():
dictionary = {"a": 1, "b": 2}
def some_function(a, b):
print(a + b)
return
some_function(**dictionary)
some_function(a=1, b=2)
Help
If you are just getting started with stern, you should be able to get started fairly quickly.
The online documentation stays up to date with the development version of stern on github. This may be a bit newer than the version of stern you are using. To upgrade to the latest full release, run pip install stern --upgrade in your terminal.
Contribute
- Issue Tracker: https://github.com/VasilSalkov/stern/issues
- Source Code: https://github.com/VasilSalkov/stern
Support
If you are having issues, please let us know. We have a mailing list located at: vasilsalkou@gmail.com with subject as stern.
Building From Source
If you want to use features that are currently in development, or you want to contribute to stern, you will need to build stern locally from its source code, rather than pip installing it.
Installing from source is fairly automated. The most work will involve compiling and installing all the stern dependencies. Once that is done, run the setup.py
script which will attempt to auto-configure, build, and install stern.
License
This library is distributed under GNU General Public License v3.0, which can be found in the file LICENSE
. We reserve the right to place future versions of this library under a different license. This basically means you can use stern in any project you want, but if you make any changes or additions to stern itself, those must be released with a compatible license (preferably submitted back to the stern project).
I 💖⚙️ STERN
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file stern-2.0.tar.gz
.
File metadata
- Download URL: stern-2.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20fcd0ee91ca03e58c7b29542a8a7b079cf642286c6333439d3eb6c58afd858d |
|
MD5 | 16c13a125516102c86e62664c69723b8 |
|
BLAKE2b-256 | 3c5d4f6d3a4a8ba90d809be6003f27a748fa08a41b5e795b1d07aa1eb0fa2041 |