A stack named FruitStack, implemented using list, contains records of some fruits. Each record is represented as a dictionary with keys 'Name', 'Origin', 'Price', and 'Expiry'. A sample record is given here:
{'Name':'Apple','Origin':'France','Price':120,'Expiry':'12-08-2025'}Write the following user-defined functions in Python to perform the specified operations on FruitStack:
(i) push_fruit(FruitStack, Fruit): This function takes the stack FruitStack and a new record Fruit as arguments and pushes the record stored in Fruit onto FruitStack if the Price is less than 100.
(ii) pop_fruit(FruitStack): This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display “UNDERFLOW”.
(iii) display(FruitStack): This function displays all the elements of the stack starting from the topmost element. If the stack is empty, the function should display 'EMPTY STACK'.
def push_fruit(FruitStack, Fruit):
if Fruit['Price'] < 100:
FruitStack.append(Fruit) def pop_fruit(FruitStack):
if len(FruitStack) == 0:
print('UNDERFLOW')
else:
return FruitStack.pop() def display(FruitStack):
if len(FruitStack) == 0:
print('EMPTY STACK')
else:
for i in range(len(FruitStack) - 1, -1, -1):
print(FruitStack[i]) The SELECT statement when combined with \(\_\_\_\_\_\_\) clause, returns records without repetition.
print(16 * 5 / 4 * 2 / 5 - 8)
myStr[:4] extracts the first 4 characters, which are "MISS".myStr[-5:] extracts the last 5 characters, which are "SIPPI"."#" in between, resulting in "MISS#SIPPI".In SQL, the aggregate function which will display the cardinality of the table is \(\_\_\_\_\_\).