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

Getting Started with Python

Getting Started with Python

Bethany Jepchumba

October 19, 2022
Tweet

More Decks by Bethany Jepchumba

Other Decks in Technology

Transcript

  1. Prerequisites – Python installed: python.org – Visual Studio Code Installed:

    code.visualstudio.com/Download – Jupyter Notebook extension on Visual Studio Code – Install git locally:
  2. Overview – Use functions to manage input and output to

    the console. – Create variables to store data. – Distinguish between data types. – Use type conversion to convert between data types. – Run code under a variety of conditions by using if, else, and elif statements.
  3. Data Types Type Description Example(s) Numeric type Number, with or

    without decimals int, float, complex, no = 3 Text type String of characters str = "a literal string" Boolean type Boolean continue = True
  4. Arithmetic Operators Type Description Example + Addition operator that adds

    two values together 1 + 1 - Subtraction operator that removes the value of the right side from the left side 1 - 2 / Division operator that divides the left side as many times as the right side specifies 10 / 2 * Multiplication operator 2 * 2
  5. Assignment Operators Operator Example = x = 2 x now

    contains 2. += x += 2 x incremented by 2. If it contained 2 before, it now has a value of 4. -= x -= 2 x decremented by 2. If it contained 2 before, it now has a value of 0. /= x /= 2 x divided by 2. If it contained 2 before, it now has a value of 1. *= x *= 2 x multiplied by 2. If it contained 2 before, it now has a value of 4.
  6. Conditional Logic – Equals: a == b – Not Equals:

    a != b – Less than: a < b – Less than or equal to a <= b – Greater than: a > b – Greater than or equal to a >= b
  7. Resources – Python for Beginners: https://aka.ms/py4beginners – Data Science for

    Beginners: https://aka.ms/ds4beginners – Machine Learning for Beginners: https://aka.ms/ml4beginners – Student hub: http://aka.ms/learnstudent