Intro to Programming in Python

Ace your homework & exams now with Quizwiz!

Escape Character

A character in a string that invokes an alternative interpretation on subsequent characters in a string, such as \n for a new line or \\ for a backslash.

== (Python)

A comparison operator that checks whether two values are equal. It evaluates to True or False.

Float (float)

A data type in programming used to represent real numbers, allowing for the representation of fractional components.

String (str)

A data type in programming used to represent text rather than numbers. It is composed of a sequence of characters, typically encoded in a standard format like ASCII or Unicode.

Integer (int)

A data type in programming used to represent whole numbers without fractional components.

Formal Language

A language designed for use in situations where natural language is unsuitable, such as computer programming. It has strict syntactic rules.

Assembly Language

A low-level programming language that uses symbolic code to represent machine code instructions, providing a slight abstraction from machine code.

Variable

A named location in memory used to store data that can be modified during program execution.

Boolean (bool)

A primitive data type with only two possible values: True or False. It is used to represent the truth values of expressions in programming.

High-Level Language

A programming language that abstracts the details of the computer hardware, focusing more on the logic and function of the code. They are more user-friendly and understandable than low-level languages.

Program

A set of instructions that a computer follows to perform a specific task.

Unified Modeling Language (UML)

A standardized modeling language in the field of software engineering that provides a general-purpose visual modeling language to visualize, specify, construct, and document the artifacts of a system.

Algorithm

A step-by-step procedure or formula for solving a problem, typically by a computer.

f-string

A string formatting mechanism in Python, introduced in version 3.6, that allows for embedding expressions inside string literals, using curly braces {}.

Activity Diagram

A type of UML diagram that represents the dynamic aspects of a system. It shows the flow of control from activity to activity within a system and is particularly useful for modeling the functionality of a system.

= (Python)

An assignment operator used to assign a value to a variable.

Computer

An electronic device capable of performing calculations and tasks according to instructions provided, known for processing data at high speeds.

Semantic Error

An error in the logic of a program. The code runs without crashing, but it does not produce the correct result or behave as intended. These errors are often harder to find and fix than syntax errors because the program does not necessarily produce any immediate error messages or signs.

Syntax Error

An error in the syntax of a programming language code. It occurs when the rules of the programming language are not followed, resulting in code that the interpreter or compiler cannot understand.

Natural Language

Any language that has developed naturally in humans through use and repetition without conscious planning or premeditation.

Comment

Non-executable text in the code used to provide context or explanations about the logic, typically used to improve code readability. In Python, there are indicated with a #.

x + y

Python code to add two variables or values, x and y.

x = 5

Python code to assign the value 5 to the variable x.

x, y = 5, 10

Python code to assign values 5 and 10 to variables x and y respectively.

elif x == 10:

Python code to check another condition if previous conditions in an if statement were false; here, checking if x equals 10.

x > y

Python code to check if x is greater than

if x > 10:

Python code to check if x is greater than 10.

x == y

Python code to compare x and y for equality.

"Hello " + "World!"

Python code to concatenate two strings.

while x < 10:

Python code to continue a loop as long as x is less than 10.

float("5.0")

Python code to convert a string to a floating-point number.

int("5")

Python code to convert a string to an integer.

"Hello".upper()

Python code to convert a string to uppercase.

str(x)

Python code to convert a variable x to a string.

def my_function():

Python code to define a function named my_function.

x / y

Python code to divide x by y.

len("Hello")

Python code to find the length of a string.

x % y

Python code to find the remainder of x divided by y.

x += 1

Python code to increment the value of x by 1.

x * y

Python code to multiply x by y.

print(x)

Python code to print the value of the variable x.

input("Enter a number: ")

Python code to prompt the user to enter a number and read the input.

"Hello World!".replace("Hello", "Goodbye")

Python code to replace a substring within a string.

"Hello World!".split()

Python code to split a string into a list of words.

for i in range(5):

Python code to start a loop that runs 5 times.

x - y

Python code to subtract y from x.

/ (Python)

The division operator that performs floating-point division, returning a float even if both operands are integers (unless in a context where integer division is specified).

// (Python)

The floor division operator that divides two numbers and rounds the result down to the nearest whole number.

% (Python)

The modulo operator that returns the remainder of a division.

Machine Code

The most basic form of software that directly controls the actions of a computer's CPU. It consists of binary code and is executed directly by the computer's hardware.


Related study sets

A6: M-3 (Compilation Engagements)

View Set

Adults 1 - Final, Final adult 1 .exm

View Set

Investing and The Stock Market Game

View Set