Criado por Matt Burkes
mais de 6 anos atrás
|
||
Questão | Responda |
find type of object? | type() |
Convert to Integer | int() |
covert to float | float() |
Convert to string | str() |
print results | print() |
less than | < |
greater than | > |
equal to | == |
not equal to | != |
length of a string | len() |
capitalize first letter of each word in a string | string.title() |
determine if each letter in a string is lowercase | string.islower() |
count occurrences of a string within a string | string.count(" ") |
return a list with each word in a string | string.split(" ") |
count items in a list | len() |
greatest element of a list | max() |
smallest element of a list | min() |
sort elements in a list smallest to largest | sorted(list) |
sort elements in a list largest to smallest | sorted(list, reverse = true) |
find the total of the numbers in a list | sum(list) |
add item to the end of a list | list.append() |
remove the last item of a list | list.pop() |
remove specific items form a list | list.pop(index) |
create a string using elements in a list | string.join(list) |
create a set | list = set() |
add item to a set | set.add(item) |
remove items form a set | set.discard(item) |
create a tupple | tupple = (item1, item2, item3) item1, item2, item3 = tupple |
Basic read from a file | f1 = open(file path, r) f1.read() f1.close() |
Read from a file so it auto closes | with open (file path, r): filedata = f.read |
Quer criar seus próprios Flashcards gratuitos com GoConqr? Saiba mais.