Python Programming Flashcards
All information on topic
What is a program?
A program is a set of instructions in order to complete a task written in code.
What is an algorithm?
An algorithm is a set of instructions in order to complete a task
What does the “print” function do?
It prints what is given in the brackets afterwards
What is a variable?
A space in computer memory that can be used to store a value or data that can be changed throughout the code.
What are the variable name rules?
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
Variable names are case-sensitive (age, Age and AGE are three different variables)
A variable name cannot be any of the Python keywords.
What is the assignment of a variable?
Assignment is giving a variable a value
What is a sequence in programming?
A sequence is when lines of code are executed one after the other
What is selection?
Selection is when lines of code will only be executed when the condition is True
What is iteration?
Repeated execution of lines of code when the condition is true
What is count-controlled iteration?
Count-controlled iteration repeatedly executes a section of code a fixed, predetermined number of times.
What is condition-controlled iteration?
Condition-controlled iteration repeatedly
executes a section of code until the condition is False
What is nesting?
Nesting occurs when one programming construct is included within another
What is concatenation?
Concatenation is the process of joining two or more strings together to form one single string
What is casting?
Casting is when you specify a type onto a variable
What is an integer?
An integer is a positive or negative whole number
What is a float?
A float is a is a positive or negative number that can be a decimal
What is a string?
A string is a data type that is a sequence of characters
What is a boolean variable?
A boolean is a True or False value to use as a truth testing procedure
What is a for loop an example of?
Count-controlled iteration
What is a while loop an example of?
Condition-controlled iteration
What is nesting?
Nesting occurs when one programming construct is included within another.
Why do we comment on our code?
To make it easier for other programmers to understand
What are the logical operators?
== , != , < , > , <= , >=
What is the != operator?
Not equal to
What is the == operator?
Equal to
What is the < operator?
Less than
What is the > operator?
Greater than
What is the <= operator?
Less than or equal to?
What is the >= operator?
Greater than or equal to
What are the arithmetic operators?
+ , - , / , * , % , // , ^ ,
What is the + operator?
Add
What is the - operator?
Subtract
What is the / operator?
Division
What is the * operator?
Multiplication
What is the // operator?
Whole number division
What is the % operator?
Modulus operator (remainder)
What is the ^ operator?
To the power of
What is an array?
An array is a set of values of the same data (forpython they can be different) type stored under one identifier