alist = ["asshole","twart","pedophile","jerk","pervert","motherfucker","moron","wanker","bastard","dope"] #credit to my beloved asshole - W bubbleSort(alist) print(alist) ['asshole', 'pedophile', 'jerk', 'pervert', 'motherfucker', 'moron', 'twart', 'bastard', 'dope', '...
Python List Methods append(item) pop(position) count(item) remove(item) extend(list) reverse() index(item) sort() insert(position, item) Python String Methods capitalize() * lstrip() center(width) ...
Real Python Python 3 Cheat Sheet说明书 Real Python:Python3Cheat Sheet
dir() function returns list of the attributes and methods of any object like functions , modules, strings, lists, dictionaries etc. If no argument passed, it returns the list of names in the current local scope.print(dir()) # ['__annotations__', '__builtins__', '__cached__', '_...
# Methods my_tuple.index('grapes') # 1 my_tuple.count('grapes') # 2 # Zip list(zip([1,2,3], [4,5,6])) # [(1, 4), (2, 5), (3, 6)] # unzip z = [(1, 2), (3, 4), (5, 6), (7, 8)] # Some output of zip() function unzip = lambda z: list(zip(*z)...
beginners_python_cheat_sheet_pcc
Asthe co-founder ofMicrosoftsays, I invite you to continue stretching your mind in an effort to broaden your programming skills with potential applications in many domains. The purpose of the article is to serve as acheat-sheetfor built-in methods of one of the basic Python data types:string...
Cheat sheet of Python. Some basic concepts for Python programmer need to know. Python Naming Styles #see: PEP8#for public usevar#for internal use_var#convention to avoid conflict keywordvar_#for private use in class__var#for protect use in class_var_#"magic" method or attributes#ex: __...
The Scikit-Learn library contains useful methods for training and applying machine learning models. Our Scikit-Learn tutorial provides more context for the code below. For a complete list of the Supervised Learning, Unsupervised Learning, and Dataset Transformation, and Model Evaluation modules in Sciki...
List MethodsGet the index of an item >>> my_list.index(a) Count an item >>> my_list.count(a) Append an item at a time >>> my_list.append('!') Remove an item >>> my_list.remove('!') Remove an item >>> del(my_list[0:1]) Reverse the list >>> my_list.reverse() ...