MIDTERM_JARED Flashcards
is one of the most popular programming languages. Although it
is a general-purpose language, it is used in various areas of applications
such as Machine Learning, Artificial
Python
is a very popular general-purpose interpreted, interactive,
object-oriented, and high-level programming language.
Python
It
was created by ___________ during ______
Guido van Rossum , 1985- 1990.
development began in the late__________ while he was working at the
________ & Informatica (CWI), a computer science research
institute in the Netherlands.
1980s, Centrum Wiskunde
One of the key factors contributing to Python’s popularity is its concise
set of keywords.
Python is Easy to learn
Python comes with a cool interactive tool called a “shell.” It’s like
having a chat with Python itself! When you open the Python shell, it
shows a friendly»_space;> prompt.
Python is Interactive
This functionality is supported by venv module in standard Python
distribution.
Create new Virtual Environment
is a name used to identify a variable, function,
class, module or other object. An identifier starts with a letter A to Z
or a to z or an underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
Python Identifiers
start with an uppercase letter. All other
identifiers start with a lowercase letter.
Python Class names
private identifier.
starts with a single leading underscore
Python programming provides no braces to indicate blocks of code for
class and function definitions or flow control. Blocks of code are
denoted by line indentation, which is rigidly enforced. All statements
within the block must be indented
Python Lines and Indentation
is a programmer-readable explanation or annotation in the
Python source code. They are added with the purpose of making the
source code easier for humans to understand, and are ignored by
Python interpreter
comment
Data items belonging to different data types are stored in computer’s
memory. Computer’s memory locations are having a number or
address, internally represented in binary form. Data is also stored in
binary form as the computer works on the principle of binary
representation.
Python Variables
First letter is a lowercase, but first letter of each
subsequent word is in uppercase.
Camel case
First letter of each word is in uppercase.
Pascal case
Use single underscore (_) character to separate words.
Snake case
represents a kind of value and determines what operations
can be done on it
Data type
Any data item having a numeric value is a number.
Number Type
Four
standard number data types in Python.
integer, floating point,
Boolean and Complex.
is a collection data type.
Sequence
three sequence
types defined in Python.
String, List and Tuple.
is a sequence of one or more Unicode characters, enclosed in
single, double or triple quotation marks (also called inverted commas).
string
is an ordered collection of any type of data items. Data
items are separated by comma (,) symbol and enclosed in square
brackets ([]). A list is also a sequence, hence.
List
is an ordered collection of any type of data items.
Data items are separated by comma (,) symbol and enclosed in
parentheses or round brackets ().
Tuple
is mutable object,
List
is immutable.
tuple
is example of mapping type.
dictionary
‘maps’ value of one object with another. In
mapping object
have key (word) and value (meaning).
Dictionary
is a Python implementation of set as defined in Mathematics.
Set
converting an object of one
type into another.
Casting
function converts an integer literal to an integer
object, a float to integer, and a string to integer if the string itself has a
valid integer literal representation.
int()
is a built-in function in Python. It returns a float object if the
argument is a float literal, integer or a string with valid floating point
representation.
float()
function works the opposite. It surrounds an integer or a float
object with quotes (‘) to return a str object. The str() function returns
the string.
str()
Typically, computer programs follow a straightforward sequence,
executing one instruction after another in the order they appear.
Control Flow
The program is able to decide which of the alternative group of
instructions to be executed, depending on value of a certain Boolean
expression.
Decision Making
Most of the processes require a group of instructions to be repeatedly
executed. In programming terminology, it is called a loop. Instead of
the next step, if the flow is redirected towards any earlier step, it
constitutes a loop.
Looping or Iteration
symbol starts an indented block. The statements with
the same level of indentation are executed if the boolean expression
in if statement is True.
colon (:)