Basic Python Control Structures and Arithmetic Operations

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

flashcard set

Earn XP

Description and Tags

30 vocabulary flashcards covering Python functions, operators, control structures, and concepts demonstrated in the lecture’s sample code.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

30 Terms

1
New cards

float()

Python built-in function that converts a value to a floating-point number.

2
New cards

int()

Python built-in function that converts a value to an integer.

3
New cards

input()

Function that pauses program execution to accept user text from the console and returns it as a string.

4
New cards

Addition Operator (+)

Arithmetic operator that computes the sum of two numbers.

5
New cards

Subtraction Operator (−)

Arithmetic operator that computes the difference between two numbers.

6
New cards

Multiplication Operator (*)

Arithmetic operator that computes the product of two numbers.

7
New cards

Division Operator (/)

Arithmetic operator that computes the quotient of two numbers as a float.

8
New cards

Modulus Operator (%)

Arithmetic operator that returns the remainder of a division operation, commonly used to test even or odd numbers.

9
New cards

Comparison Operator (!=)

Operator that evaluates to True when two operands are not equal.

10
New cards

Comparison Operator (>)

Operator that evaluates to True when the left operand is strictly greater than the right operand.

11
New cards

Comparison Operator (>=)

Operator that evaluates to True when the left operand is greater than or equal to the right operand.

12
New cards

if Statement

Control structure that executes a block of code only when its condition evaluates to True.

13
New cards

else Clause

Part of an if statement that executes when the if condition evaluates to False.

14
New cards

f-string

Formatted string literal prefixed with f that allows inline expression evaluation using curly braces.

15
New cards

Function Definition (def)

Python keyword used to declare a reusable block of code that can accept parameters and return a value.

16
New cards

Return Statement

Statement inside a function that immediately ends execution and sends a value back to the caller.

17
New cards

Parameter

Variable listed in a function’s definition that receives a value when the function is called.

18
New cards

Argument

Actual value passed to a function parameter during a call.

19
New cards

Variable

Named storage location used to hold data that can be changed during program execution.

20
New cards

Type Casting

Explicit conversion of one data type to another, such as converting a string from input() to int or float.

21
New cards

Zero Division Guard

Programming pattern that checks if a divisor is zero before performing division to avoid runtime errors.

22
New cards

Even Number

Integer divisible by 2 with no remainder (number % 2 == 0).

23
New cards

Odd Number

Integer that leaves a remainder of 1 when divided by 2 (number % 2 != 0).

24
New cards

Product

Result obtained from multiplying two numbers (num1 * num2).

25
New cards

Sum

Result obtained from adding two numbers (num1 + num2).

26
New cards

Attendance Percentage

Ratio of attended classes to total classes multiplied by 100 to measure class participation.

27
New cards

Eligibility Check

Conditional test that determines if a student can sit for an exam based on attendance percentage ≥ 75.

28
New cards

Condition

Boolean expression evaluated within control structures like if and else.

29
New cards

User Prompt

Text displayed inside input() to inform users what data to enter.

30
New cards

Console Output

Information displayed to the user via print() statements during program execution.