Answer:
The solution code is written in Python 3:
- def modifyList(listNumber):
- posCount = 0
- negCount = 0
-
- for x in listNumber:
- if x > 0:
- posCount += 1
- else:
- negCount += 1
-
- if(posCount == len(listNumber)):
- listNumber.append(max(listNumber))
-
- if(negCount == len(listNumber)):
- listNumber.append(min(listNumber))
-
- print(listNumber)
-
- modifyList([-1,-99,-81])
- modifyList([1,99,8])
- modifyList([-1,99,-81])
Explanation:
The key step to solve this problem is to define two variables, posCount and negCount, to track the number of positive value and negative value from the input list (Line 2 - 3).
To track the posCount and negCount, we can traverse through the for-loop and create if else statement to check if the current number x is bigger than 0 then increment posCount by 1 otherwise increment negCount (Line 5- 9).
If all number in the list are positive, the posCount should be equal to the length of the input list and the same rule is applied to negCount. If one of them happens, the listNumber will append either the maximum number (Line 11 -12) or append the minimum number (Line 14-15).
If both posCount and negCount are not equal to the list length, the block of code Line 11 -15 will be skipped.
At last we can print the listNumber (Line 17).
If we test our function using the three sets of input list, we shall get the following results:
[-1, -99, -81, -99]
[1, 99, 8, 99]
[-1, 99, -81]
<u>Question 9:</u>
The correct answer would be either (b) or (d).
<u>Question 10:</u>
<u></u>
The correct answer would be (b).
Hope it helps. :)
Question:
Which of these field types allows multiple, non-exclusive options?
A. multi-part
B. checkbox
C. text
D. radio button
E. button
Answer:
The correct option is B) Checkboxes
Explanation:
Field types is a terminology often associated with Database Management.
A field type is often found in a data collection apparatus such a form. It's inherent quality or nature will determine the kind of data that it can collect.
Some field types allow for exclusive options. That is, in some data field types, it's impossible to select more than one option.
For example, a Button field type can only collect one type of value.
A Checkbox on the other can be configured to allow for multiple selections which may or may not be exclusive.
When working with Microsoft Access, for instance, you are required to select the name of the <em>field </em>and define the type of <em>field data.</em>
<em />
Cheers!