Answer:
Assuming this is 0 based array indexing, it would look like this...
[ 5, 6, 10, 7, 3, 2.5 ]
[ 0, 1, 2, 3, 4, 5, 6 ]
The index of 7 would be 3.
Answer:
B
Explanation:
When you initialize an instance of FunEvent(tags, year) and assign it to bc. The instance variables in this case are: self.tags = ["g", "ml"] and self.year = 2022. But then you alter tags, which will also change self.tags, since self.tags is a reference to the list you passed in as an argument. This is not the case when you do year=2023 because, first of all, integers are not mutable, and also because even if somehow integers were mutable, you're not changing the object in-place, you're simply changing the where the "variable" is pointing to. So for example if you did tags = ["g", "ml", "bc"] instead of tags.append("bc"), it would also not change the value of the instance variable "tags", because you wouldn't be changing the object in-place. So when you print(bc), the instance variables will be ["g", "ml", "bc"] and 2022. When you try to print an object, it call try to convert it into a string using the __str__ magic method. In this case it will return a string formatted as "Event(tags={self.tags}, year={self.year}) which will output "Event(tags=['g', 'ml', 'bc'], year=2022)" So the correct answer is B
Answer:
def get_middle_ten(sentence):
ind = (len(sentence) - 12) // 2
return sentence[ind:ind + 12]
# Testing the function here. ignore/remove the code below if not required
print(get_middle_twelve("abcdefghijkl"))
print(get_middle_twelve("abcdefghijklmnopqr"))
print(get_middle_twelve("abcdefghijklmnopqrst"))
Answer:
D. Algorithms need to be written in the design phase so they can be translated into code in the development phase.
Explanation:
Answer:
DHCP is the dynamic host configuration protocol that enable the server for assigning the IP address to the computer. It is basically used to provide automatic IP addresses within the network. It is basically used to configure the default gateway and provide the DNS server data in the device.
The optional parameter when configuring DHCP are:
- Sub-net mask
- Router
- Domain server
- Broadcast address
- Host name