112 Final Study Guide Chapters 1-7 Flashcards
What are the main characteristics of an interpreted programming language? (module 1)
You (or any user of the code) need to translate the source program each time it has to be run. The program translating your source is called an interpreter.
An interpreter interprets your code each time it is executed
Interpreted codes are harder to be distributed, because both the sender and receiver require the same interpreter.
What kind of programing language is python? (module 1)
Python is a high level, interpreted, object oriented programming language.
Who created Python? (module 1)
Guido van Rossum
Name some advantages of using an Interpreted programming language. (module 1)
You can run the code as soon as you complete it - there are no additional phases of translation.
The code is stored using programming language, not machine language - this means that it can be run on computers using different machine languages.
You don’t compile your code separately for each different architecture.
Name some disadvantages of using an interpreted programming language. (module 1)
Not as fast as a compiled program. Interpreted code runs at the speed that your computers power allows.Both you and the end user have to use an interpreter to run your code.
What are the goals of python as a programming language? (module 1)
- Python should be easy and intuitive to use, but still as powerful as other competing languages.
- Python should remain open sourced. Anybody should be allowed to contribute to its development.
- Python code should be understandable as plain English.
- Python must be suitable for everyday tasks, and allow for shorter development times.
What differentiates python from other high-level programming languages? (module 1)
Python is easy to learn, teach, use, understand, and obtain.
Define functions and arguments. (module 2)
Functions are lines in python that are made to cause an effect, or evaluate a value.
Generally, functions in python will look something along the lines of this:function_name(argument)
Arguments are found inside a functions parentheses. There are many different types of arguments in Python. They are necessary for functions to work.
Describe the importance of using quotation marks while using the print() function. (module 2)
When you use quotations, the print function will print exactly what you type in between them. This creates something known as a string. If you do not use quotation marks, the program will try to print a variable assigned to the text inputted.
How do you separate arguments inside of a function? (module 2)
Inside of the brackets, you can separate arguments using commas. ex. print(“Hello, my name is”, input)
Define literals. (module 2)
A literal is data whos values are determined by the literal itself. Literals can be used to encode your data and put it directly into your code.
Define integers and floats. (module 2)
Integers are whole numbers that do not include fractional parts. (ex. 1)
Floats (aka floating point numbers) that are able to contain fractional parts. (ex. 1.0)
What are Boolean values? (module 2)
Boolean values are the two constant objects True and False used to represent truth values in numeric contexts.
What are operators? (module 2)
Operators are symbols in programming language which are used to operate on values.
Data and operators when put together in a line become an expression.
List and define some basic arithmetic operators. (module 2)
”+” Addition”-“ Subtraction”*” Multiplication”/” Division”**” Exponent”//” integer divisional (the result of the division will always be an integer)”%” calculates the remainder after integer division.
What are variables? (module 2)
Variables are like boxes that store the results of an operation. Each value consists of two parts:
A name
The value of what is placed inside of it.
What are the rules for naming variables? (module 2)
The name must be composed of upper or lower case letters
.The name must begin with a letter.
The underscore character acts as a letter when naming variables
Names are case sensitive
Names of variables can not match any of Pythons built in key words.
How do you create a variable? (module 2)
A variable is created when you assign a value to it. You do so using the “=” assignment operator.
Ex.var = 1
Describe shortcut operators. (Module 2)
Shortcut operators can change variables without the need to write the entire expression out again.
For example.
Instead of writing x = x + 1 You can use a shortcut operator and compress this expression into:
x += 1
How do you leave a comment in a code? (module 2)
This is a comment Example
You use hashtags to surround the comment. They can be left on any line as long as the hashtags are present.
Describe the input() function. (module 2)
The input function allows a program to take user inputted data and use it in the code. The argument in an input function is a string designed to prompt the user to input a message.
What is the result of an input function? (module 2)
The result unless otherwise stated will always be a string.
How do you convert inputs into variables? (module 2)
You have to indicate that the input will be a float or an integer when writing the line of code, and assign it a variable.
Example:
var = float(input(“Enter a number:”))