0% found this document useful (0 votes)
15 views

Python Introduction

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Python Introduction

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python for Scientific Computing: Introduction to Python

Via browser:

 Anaconda.cloud
 Colab.research.google.com

Current version: 3.11.x


Whitespace at beginning of command is important. Defines code blocks
Python implementation is both a compiled and interpreted language.
Python Code  Compiler (translates from 1 language to another)  Byte Code (binary 1s
and 0s) interpreter  machine code

Learn how to read error messages


NameError (e.g. if writing “pint” instead of “print”) – most common error

 All programs will contain multiple lines of code


 Write in text editor (e.g. Notepad++)
 Integrated Development Environment (IDE) e.g. PyCharm
o Simplifies development, smart indenting, debugging, etc

Variables

 Variable = store.
 Variable has datatype: number, text, list, etc
 Python is dynamicially typed. No need to declare type of variable.
 Variables stored in memory. Memory is transient so you need to save it.
 Follow strict naming conventions
 Variable names must start with letter or underscore. Cannot start with a number.
Names are case sensitive. case_sensitive, CASE_SENSITIVE are each a different
variables
 Good variable names = readability, descriptive. PEP-8

Data types:

 String in double quotes e.g. age=“twenty”

You might also like