Technical computing basics#
In this unit, we introduce basic technical computing concepts and tools:
Variables, expressions, and types: A variable is a named location in memory that stores a value. An expression is a combination of variables, literals, and operators that can be evaluated to a single value. For example, the expression “x + 2” would add the value stored in the variable x to 2. Types are categories that identify the kind of value an expression produces. For example, the expression “2 + 3” produces an integer value of the “int” type. Other types include “float” (for decimal values), “str” (for string values), and “bool” (for Boolean values).
Functions are blocks of code that perform a specific task and can be called (invoked) by name. Functions can accept input arguments (parameters) and may return a value or result.
Programs and modules are collections of computer code. A computer program is a set of instructions that a computer can execute to perform a specific task or solve a problem. On the other hand, a module is a file containing code that can be imported into a program or another module. Modules allow you to reuse code across multiple programs and projects.
File and Data I/O refers to input/output operations involving files or other data sources such as application programming interfaces. Simple File I/O operations allow you to read from and write to files on your computer’s filesystem. For example, you might use File I/O to read data from a text file or save a program’s results to a file.