Unit 1 - Lesson 1 - Programming Basics Flashcards
What is a String?
A series of characters inside quote marks.
Strings can contain single character, a word, a phrase, a sentence, or entire paragraphs
For example:
“Hello World”
What does the computer do with comments added to a program?
The computer passes over comments added to a program without turning them into machine code.
In other words, the computer will ignore the comments.
Explain the syntax of a print command. What goes in the brackets?
The syntax of the print command begins with the word print in lower case Then there are brackets. The content that is to be displayed goes inside the brackets.
Describe what happens when you run a python program?
When you run a python program, the lines of the program are converted into machine code one by one, and immediately executed.
What does IDE stand for?
IDE stands for integrated development environment.
What is the purpose of IDE software?
IDE software allows you to save your program.
What features does an IDE have that you would not find in an ordinary word processor?
An IDE lets you type up your program and save it, runs your code, gives you guidance about errors in your code, and uses colour to show the different features of the code.
While using an IDLE, where will you see the results of the programs?
The results will be shown in the Shell window.
An IDLE has two different windows, what are their names?
IDLE has two windows called Python Shell and Program Editor:
What is the name for code that represents a data value?
A variable
What is the command to assign the value 19.99 to the variable ticket_cost?
ticket_cost = 19.99
What is the command to output the value stored in the variable ticket_cost?
print(ticket_cost)
What is wrong with the following variable name:
Character Name
Character Name is bad as it includes a space. When a variable name consists out of more than one word the words need to be separated by an underscore and not a space
What is wrong with the following variable name:
5star
5star is bad because it starts with a number. Variable names cannot start with a number as this will produce an syntax error.
What is wrong with the following variable name:
myvariable
myvariable is not a good variable name, because the two words “my” and “variable” are not separated by an underscore, which makes it difficult to read.
myvariable is also not very meaningful, as it doesn’t tell us much about the kind of values that will be stored in it.