QUESTION IMAGE
Question
3.1 knowledge check computer science - a - spd - 2526 / unit 3 - data structures and for lo...
- match the following:
- what do you use the in operator for?
- what begins and ends a multi - line string?
- do you have to use all capitals for constant variables?
- what kind of value does the in operator return?
- what is a constant?
- what is a list?
a. three single - quotes
b. an operator that makes it easy to see if a value is inside a list or not.
c. variables whose values do not change throughout the program.
d. a data - type which can contain several other values inside of it.
e. using uppercase characters is valuable but not required because it makes it easier for other programmers to understand how these variables are used.
f. a boolean value: true if the value is in the list and false if the value is not in the list.
- which of the following will correctly change the second item in this list to be all caps?
animals = aardvark, anteater, antelope, albert
animals2=anteater
animals1=anteater
animals(1)=anteater
animals(2)=anteater
- rank yourself on a scale of 1 - 4 on how well you completed the lab project for lesson 1.
1 - i looked at it, but didnt even try it.
2 - i spent a few minutes (about 5) trying to figure it out but gave up.
3 - it mostly works, but there are a couple bugs i havent been able to resolve.
4 - it works perfectly without any problems.
1.
- The 'in' operator in programming (like Python) checks if a value is in a list, returning a boolean. So, 1 matches b.
- Multi - line strings in Python start and end with three single - quotes, so 2 matches a.
- Using all capitals for constants is a convention, not a requirement, so 3 matches e.
- The 'in' operator returns a boolean value, so 4 matches f.
- A constant is a variable whose value doesn't change, so 5 matches c.
- A list is a data - type that can hold multiple values, so 6 matches d.
- In Python, list indexing starts at 0. So the second item has an index of 1. To change it to all caps, we use
animals[1]='ANTEATER'. - This is a self - assessment question and there is no right or wrong answer based on programming knowledge.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
1.
- b
- a
- e
- f
- c
- d
- animals[1]='ANTEATER'
- (This is a self - assessment, answer based on personal experience)