Skip to content

Instantly share code, notes, and snippets.

@budiantoip
Last active May 13, 2023 04:20
Show Gist options
  • Save budiantoip/755300481230b834366e5521cc3619f0 to your computer and use it in GitHub Desktop.
Save budiantoip/755300481230b834366e5521cc3619f0 to your computer and use it in GitHub Desktop.
Python

Referrence : https://www.youtube.com/playlist?list=PLZS-MHyEIRo59lUBwU-XHH7Ymmb04ffOY

Install python on mac, we need to install pyenv first, so we can easily manage the python versioning

brew install pyenv

display the version of pyenv

pyenv --version

display the existing python versions

python versions

install specific python version

pyenv install 3.10.0

to use the above python version

pyenv global 3.10.0

to comment out a line of code, simply prefix the line with

a python source code file which extension is py

can be compiled to a bytecode for a faster execution

to compile the file into the bytecode, simply use this terminal command

python3 -m py_compile <filename.py>

if we want to enter python shell mode,

simply type python3 in the terminal and then press enter

Data types in Python

  1. Integer
  2. Float
  3. String
  4. Boolean
  5. Complex
  6. Import from C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment