You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Process a list of records, where each record is a dictionary with string keys and integer values.
192
+
193
+
:param records: A list containing dictionaries that map strings to integers.
194
+
:return: A list of sums of the integer values in each record.
195
+
"""
196
+
sums= []
197
+
forrecordinrecords:
198
+
# Sum up all the values in each dictionary and append the result to the sums list
199
+
total=sum(record.values())
200
+
sums.append(total)
201
+
returnjson.dumps({"sums": sums})
202
+
203
+
204
+
# Example User Input for Each Function
205
+
# 1. Fetch Current DateTime
206
+
# User Input: "What is the current date and time?"
207
+
# User Input: "What is the current date and time in '%Y-%m-%d %H:%M:%S' format?"
208
+
209
+
# 2. Fetch Weather
210
+
# User Input: "Can you provide the weather information for New York?"
211
+
212
+
# 3. Send Email
213
+
# User Input: "Send an email to john.doe@example.com with the subject 'Meeting Reminder' and body 'Don't forget our meeting at 3 PM.'"
214
+
215
+
# 4. Calculate Sum
216
+
# User Input: "What is the sum of 45 and 55?"
217
+
218
+
# 5. Convert Temperature
219
+
# User Input: "Convert 25 degrees Celsius to Fahrenheit."
220
+
221
+
# 6. Toggle Flag
222
+
# User Input: "Toggle the flag True."
223
+
224
+
# 7. Merge Dictionaries
225
+
# User Input: "Merge these two dictionaries: {'name': 'Alice'} and {'age': 30}."
226
+
227
+
# 8. Get User Info
228
+
# User Input: "Retrieve user information for user ID 1."
229
+
230
+
# 9. Longest Word in Sentences
231
+
# User Input: "Find the longest word in each of these sentences: ['The quick brown fox jumps over the lazy dog', 'Python is an amazing programming language', 'Azure AI capabilities are impressive']."
232
+
233
+
# 10. Process Records
234
+
# User Input: "Process the following records: [{'a': 10, 'b': 20}, {'x': 5, 'y': 15, 'z': 25}, {'m': 30}]."
235
+
236
+
# Statically defined user functions for fast reference
0 commit comments