Chapter 2: Input, Processing, And Output Flashcards
Who is a programmer’s customer?
Clients
What is a software requirement?
It is the first and inital step in developing programs.
What is an algorithm?
The set of rules or instruction which may be performed in order to complete the task.
What is pseudocode?
pseudocode is an informal description of algorithm.
What is a flowchart?
What do each of the following symbols mean in a flowchart?
• Oval
• Parallelogram
• Rectangle
• The ovals, which appear at the top and bottom of the flowchart, are called terminal
symbols. The Start terminal symbol marks the program’s starting point and the End
terminal symbol marks the program’s ending point.
• Parallelograms are used as input symbols and output symbols. They represent steps in
which the program reads input or displays output.
• Rectangles are used as processing symbols. They represent steps in which the program
performs some process on data, such as a mathematical calculation.
Write a statement that displays your name.
print(‘Name’)
Write a statement that displays the following text:
Python’s the best!
Use double quation marks to display a string of charaters
print(“Python’s the best!”)
or
print(‘Python's the best!’)
Write a statement that displays the following text:
The cat said “meow.”
print(‘The cat said “meow.”’)
or
print(“The cat said "meow."”)
Write a statement that displays:
I’m reading “Hamlet” tonight.
print(“"”I’m reading “Hamlet” tonight.”””)
or
print(“I’m reading "Hamlet" tonight”)
Triple quotes you can put double and single quations in a statement.
Write a comment saying:
The is a comment
This is a comment
Legal or Not Legal for naming variables?
- legal
- legal
- illegal variables cannot start with digits
- legal
- illegal variables can only have letters, digits, and underscores
What is a variable?
variables are memory locations of the computer which are used for storing the data values temparory , during the execution of an application.
Which of the following are illegal variable names in Python, and why?
- x
- 99bottles
- july2009
- theSalesFigureForFiscalYear
- r&d
- grade_report
The 5th and 3rd variable is incorrect
Is the variable name Sales the same as sales? Why or why not?
These are different variables. One is capital and one is lower case.
Is the following assignment statement valid or invalid? If it is invalid, why?
72 = amount
the statement is illegal. The variable comes first before the value.
amount = 72 # valid
72 = amount # invalid
What will the following code display?
val = 99
print(‘The value is’, ‘val’)
The value is val
Look at the following assignment statements:
value1 = 99
value2 = 45.9
value3 = 7.0
value4 = 7
value5 = ‘abc’
After these statements execute, what is the Python data type of the values referenced by each variable?
- integer
- float
- float
- integer
- string
What will be displayed by the following program?
my_value = 99
my_value = 0
print(my_value)
0
The first variable got overwritten or redefine.
You need the user of a program to enter a customer’s last name. Write a statement that prompts the user to enter this data and assigns the input to a variable.
c_last_name = input(“Enter the customer’s last name”)