Skip to main content

Cheatsheet

Hello Everyone for this class, I will focus in teaching the concepts, so you don't need to memorize anything|

I will be creating a cheatlist with the commands and comment what they do below while we go through the course|

Programming Terms​

Chapter 1​

TermDefinition
SyntaxThe spelling and grammar of a programming language (similar to the rules for using words, phrases, clauses and punctuation used to form sentences in English). Computers are inflexible machines that understand what you type only if you follow the rules that specify the correct combined sequence of symbols to form a correctly structured program that the computer expects. This expected form is called the syntax.
Comments and ReadabilityLine(s) of text or code that are NOT read by the computer, and rather read by you and other programmers. This improves the readability of the code. that is, it makes it easy to understand the use of the code when we get back to it at a later time.
StringText type data that is represented using single quotes or double quotes.
NumberNumber type of data that can be understood by Python includes integers, floating point numbers.
IDEShort for Integrated Development Environment. It is a software where all the required components needed to write and run code is available in one place.
ExecuteTo run a program such that the instructions given by us are carried out to display the output.
Test & DebugIdentify and remove errors from computer hardware or software.
Escape CharacterBackslash \ is a character which invokes an alternative interpretation of subsequent characters.
Escape SequencesA sequence of characters that doesn't represent itself when used inside a string. It is composed of two or more characters starting with backslash \
DecomposeBreak down a problem in sequence.
EmbedTo place (a piece of software) inside a virtual space. Embedded code can run by themselves, without a need for an external program.

Chapter 2​

TermDefinition
VariableA label that points to a varying quantity. We can manipulate the data referenced by the label using Python code.
StatementA line of code that can be executed by Python.
OperatorA operator is represented by a symbol or short text and performs a specific function and provides a result. An operator requires operands, which are the values that it acts upon. Ex
Builtin functionPre defined blocks of code that perform a specific function. Example - print(), min(), max().
ConcatenationJoining two strings together.
ReusabilityQuality of the code that allows it to be reused.
SequencingArranging instructions in a specific order so that the expected result is observed when the instructions are processed.

Chapter 3​

πŸ‘€

TermDefinition
User inputA feature in programming languages that allows users to provide the inputs for a program.
PromptA symbol or some text from a program indicating that it is waiting for an input from the user.
Exampleinput(β€œEnter your name β€œ) - In this line of code, β€œEnter your name” is the prompt.
TestThe process of finding how well your code works by providing different inputs to the program.
ReusabilityQuality of the code that allows it to be reused.
Syntax errorAn error in a program that has been caused due to incorrect language or grammar rules.
Syntax Error examplePrint(β€œGood morning!”) - In this line of code, alphabet p in print() has been capitalized, resulting in a syntax error.
Logical errorAn error that causes the program to behave in a different manner as opposed to what was expected.
Logical error exampleprint(β€œ34 + 66”) would result in 34 + 66 being printed. If the intention is to print the sum of 34 and 66, we need to remove the quotes.
Builtin functionPre-defined blocks of code that perform a specific function. Example - input(), print(), min(), max().
DocstringLines that describe a part of the code or a program, which are enclosed using triple quotes (single or double).

Chapter 4​

Boolean data type: Just like string and number, boolean is a permissible data type in Python. Boolean data type allows only two values - True or False.Ex: a = True. In this statement, the variable a is not a string data type, but a boolean data type. Boolean expression: An expression is a series of values and operations that evaluate to something. Ex: 5 + 6 is an expression. So is 11/3+45. Boolean expressions compare data of any type as long as both data being compared are of the same data type. A boolean expression evaluates to a boolean value of True or False. Complex Boolean expressions can be created by joining multiple Boolean expressions with the logical operators (and, or, not). Boolean expressions compare data of any type as long as both data being compared are of the same data type.

Comparison operator: Comparison operator compares two different values and returns whether the comparison is True or False. Ex: In the expression, 5 > 3, > (greater than) is the comparison operator that compares 5 and 3. This expression results in True. The 6 comparison operators are:

== (equal to; example: x == 5)

!= (not equal to; example: x != 5)

(greater than; example: y > 3)

< (less than; example: x < 5 )

= (greater than or equal to; example: x >= y)

<= (less than or equal to; example: x <= y)

Logical operator: Logical operators allow two or more expressions to be combined and evaluated to a single boolean value. There are three logical operators - and, or, not. and operator returns True only if all the individual expressions combined by and are true. Ex: (5 > 3) and (5 > 4)

or operator returns True if any one of the individual expressions combined by or is true. Ex: (5 > 3) or (5 < 5)

not operator reverses the result of a boolean expression. Ex: not(5 > 3) is not(True) which returns False.

Conditional structure:This is a fundamental building block in coding. Based on whether a condition ( a boolean expression) is true or false, a specific branch of the program is executed, instead of all the statements in the program. The syntax for a conditional structure is given in this manner:

If (Boolean condition1) Then

(perform computation or action)

Else if (Boolean condition2) Then

(perform another computation or action)

Else

(perform a default computation or action)