Answer:
-- While mainly a readability feature, we can technically use Enum to do things like spoof a Boolean type in C allowing us some level of functionality.
-- Enums are great for representing states and other common constants like colors.
-- Enums let us specifically value each constant we create.
Explanation:
Enums is a part of a programming language which helps a developer or a programmer to defined a set of the named constants. Using the enums will help in making it easier to document the intent and also to create set of distinct cases.
Option 1 is applicable as in the Boolean there are only TRUE and FALSE values. By using enum one can add more state like that of being difficult or normal or easy.
Option 4 is applicable because enums are used to represent various states and also other constants.
Option 5 is also applicable they allow the developer to create each value constant.
Answer:
Explanation:
The code provided aside from some minor errors (fixed version down below) is correct, but it will never be able to accomplish what is being asked in the question. This is because this code is simply copying and returning the exact same list that is passed as an argument, because it is looping through it and comparing its own elements. In order to accomplish what is asked in the question, two lists need to be passed as parameters. The first would be the original list, and the second would be a list of test elements that will be used to compare and see if they exist in the original list. This would allow us to create a new list with only the elements that existed in the original list.
def filter_only_strs(lst):
for x in lst:
if not isinstance(x, str):
lst.remove(x)
return lst
Answer:
None of those answers is correct because E[1101] is index out of range.