Programming in Python, End Term
What will be the output of the following Python code?
words = ["jacket", "cap", "scarf", "hat", "sock"]
result = []
for idx, word in enumerate(words):
if idx % 2 == 0:
result.append(word[:2].upper() + str(idx))
elif len(word) > 4:
result.append(word[::-1][:3])
else:
result.append("0" + word[-1])
print(result)
What will be the output of the following Python code?\ words = \["jacket", "cap", "scarf", "hat", "sock"\]\ result = \[\]\ **for** idx, word **in** enumerate(words):\ **if** idx % 2 == 0:\ result.append(word\[:2\].upper() + str(idx))\ **elif** len(word) \> 4:\ result.append(word\[::-1\]\[:3\])\ **else**:\ result.append("0" + word\[-1\])\ print(result) Consider the following Python code:\ **def** evaluate\_score(score):\ **if** score \>= 90:\ **if** score == 100:\ print("Perfect Score")\ **else**:\ print("Excellent")\ **elif** score \>= 60:\ **if** score \>= 80:\ print("Very Good")\ **else**:\ print("Good")\ **else**:\ **if** score \>= 40:\ **if** score % 2 == 0:\ print("Needs Improvement")\ **else**:\ print("Barely Passed")\ **else**:\ print("Fail")\ Which of the following inputs will produce the output Needs Improvement ? Consider the following Python code:\ **class** **Employee**:\ **def** \_\_init\_\_(self, name):\ self.name = name\ self.role = "Employee"\ **def** show\_details(self):\ print(f"**\{**self.name**\}** works as **\{**self.role**\}**")\ **class** **Developer**(Employee):\ **def** \_\_init\_\_(self, name):\ super().\_\_init\_\_(name)\ self.role = "Developer"\ **def** show\_details(self):\ print(f"**\{**self.name**\}** writes code as a **\{**self.role**\}**")\ super().show\_details()\ **class** **Manager**(Employee):\ **def** \_\_init\_\_(self, name):\ super().\_\_init\_\_(name)\ self.role = "Manager"\ **def** show\_details(self):\ print(f"**\{**self.name**\}** manages tasks as a **\{**self.role**\}**")\ super().show\_details()\ employees = \[\ Developer("Ananya"),\ Manager("Rajeev"),\ Developer("Kiran")\ \]\ **for** emp **in** employees:\ emp.show\_details()\ What will be the **output** of the code above?