Built-in functions (sum, min, max, abs)
Në shqip: Funksionet e integruara
ShpjegimiSQ
Python-i ka shumë funksione gati pa import: sum(), min(), max(), abs(), round(), sorted(), len(), type(), help() dhe dir(). Para se të shkruash një funksion vetë, kontrollo nëse ekziston.
EnglishEN
Python has lots of functions ready without any import: sum(), min(), max(), abs(), round(), sorted(), len(), type(), help() and dir(). Before writing a function yourself, check whether it already exists.
Si ta mendosh
Si veglat që vijnë me kuzhinën: thika, luga, tava — s'ke pse i blen veç.
Lexoje në anglisht
Like the utensils that come with the kitchen: knife, spoon, pan — no need to buy them separately.
Shembull kodipython
notat = [5, 3, 4, 5]
print(sum(notat), min(notat), max(notat)) # 17 3 5
print(round(sum(notat) / len(notat), 2)) # 4.25