Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python basics

33ef5d91f533572132d545eb068504ed?s=47 b4d
November 09, 2016

Python basics

Course held at National Institute of Chemistry in Ljubljana, 2016.

33ef5d91f533572132d545eb068504ed?s=128

b4d

November 09, 2016
Tweet

Transcript

  1. INTRODUCTION PYTHON

  2. GOALS OUR ? ‣HAVE FUN ‣SAVE TIME ‣DO MAGIC

  3. THERE HOW TO GET ? ‣TIMETABLE ‣HOMEWORK ‣DURATION

  4. None
  5. print “Hello world” PYTHON 01000001 01000111 00001001 01100011 01100001 01000010

    01001101 00111011 11010110 01000101 00000111 10101010 00011011 11000100 00100001 01101100 00000001 10010000 00000101 00000000 10101010 10001111 … BINARY CODE (FAKE)
  6. PYTHON WHAT IS ? ‣OPEN ‣FREE ‣EASY*

  7. DIVE INTO SLIDES ARE BORING

  8. None
  9. None
  10. INTRODUCTION PYTHON PART TWO

  11. VARIABLES SPREMENLJIVKE

  12. BOOLEAN a = True b = False BOOLEAN

  13. NUMBERS a = 10 b = 10.2 INTEGER FLOAT

  14. STRINGS a = “niz znakov” INTEGER

  15. OPERATORS ARITHMETIC

  16. MATH OPERATIONS + - * / % **

  17. STRINGS NIZI ZNAKOV

  18. STRINGS a = “char \”escaping\” too” znak = “cats”[0] CHAR

    ESCAPE INDEXING
  19. “test”.lower() STRING FUNCTIONS “test”.upper() LOWERCASE UPPERCASE len(“test”) LENGTH

  20. TRICKS VARIOUS

  21. COMMENTS # comment 1 “”” comment 1 comment 2 “””

    SINGLE LINE MULTI LINE
  22. print “text” PRINTING print a STRING VARIABLE print “a” +

    “b” CONCATENATION
  23. “3”.int() TYPE CASTING str(3) STRING TO INT INT TO STRING

  24. INTRODUCTION PYTHON PART THREE

  25. raw_input(“Ime: ”) INPUT STRING

  26. == != < > <= >= COMPARATORS

  27. and or not BOOLEAN OPERATORS not and or PRIORITY

  28. if x < 9: print “st. x je manjse od

    9” elif x > 9: print “st. x je vecje od 9” else: print “st. x je enako 9” CONDITIONAL STATEMENTS
  29. INTRODUCTION PYTHON PART FOUR

  30. INTRODUCTION PYTHON PART FIVE

  31. INTRODUCTION PYTHON PART SIX