GoConqr has a new look! Let us know what you think.

Flashcards

Python Cheat Sheet

Matt Burkes English 31 cards

Cards in this deck (31)

  1. 1find type of object?type()
  2. 2Convert to Integerint()
  3. 3covert to floatfloat()
  4. 4Convert to stringstr()
  5. 5print resultsprint()
  6. 6less than<
  7. 7greater than>
  8. 8equal to==
  9. 9not equal to!=
  10. 10length of a stringlen()
  11. 11capitalize first letter of each word in a stringstring.title()
  12. 12determine if each letter in a string is lowercasestring.islower()
  13. 13count occurrences of a string within a stringstring.count(" ")
  14. 14return a list with each word in a stringstring.split(" ")
  15. 15count items in a listlen()
  16. 16greatest element of a listmax()
  17. 17smallest element of a listmin()
  18. 18sort elements in a list smallest to largestsorted(list)
  19. 19sort elements in a list largest to smallestsorted(list, reverse = true)
  20. 20find the total of the numbers in a listsum(list)
  21. 21add item to the end of a listlist.append()
  22. 22remove the last item of a listlist.pop()
  23. 23remove specific items form a listlist.pop(index)
  24. 24create a string using elements in a liststring.join(list)
  25. 25create a setlist = set()
  26. 26add item to a setset.add(item)
  27. 27remove items form a setset.discard(item)
  28. 28create a tuppletupple = (item1, item2, item3)
    item1, item2, item3 = tupple
  29. 29Basic read from a filef1 = open(file path, r)
    f1.read()
    f1.close()
  30. 30Read from a file so it auto closeswith open (file path, r):
    filedata = f.read
  31. 31—

Information

Description
A quick beginner guide to some basic python tools
Created by
Matt Burkes
Views
226
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?