1{2 "document_id": "exec_00124_2000",3 "family": "exec",4 "split": "dev",5 "document_hash": "a285cd3f7f5bbfcaa508697bf261341dc847483a97e354b95faf09bc23bb626f",6 "questions": [7 {8 "question_id": "q00_exec",9 "qtype": "exec",10 "question": "Rewrite the Python function net_revenue(rows) so that it implements ALL the agreed rules in the ticket. Output only Python code defining net_revenue; no explanations, no markdown fences.",11 "answer": "\ndef net_revenue(rows):\n total = 0.0\n for r in rows:\n if r['returned']:\n continue\n if r['region'] == 'Ouest':\n continue\n if r['units'] < 3:\n continue\n total += r['units'] * r['unit_price'] * (1 - r['discount_pct'] / 100.0)\n total = total * (1 + 5.0 / 100.0)\n return round(total, 0)\n",12 "answer_type": "exec",13 "tolerance": 0.0,14 "supporting_fact_ids": [15 "spec"16 ],17 "answer_position_frac": 0.02,18 "aliases": []19 }20 ],21 "facts": [22 {23 "fact_id": "spec",24 "entity": "net_revenue",25 "attribute": "rules",26 "value": "{\"thr_days\": 6, \"min_units\": 3, \"excl_region\": \"Ouest\", \"rounding\": 0, \"tax\": 5.0}",27 "kind": "spec",28 "sentence": "Bug report BR-4820: the function net_revenue(rows) must compute the total net revenue of the rows list (each row is a dict with keys ['region', 'product', 'units', 'unit_price', 'discount_pct', 'returned', 'shipped_days']). Rules agreed with the client on 7 September 2031: (1) exclude returned rows; (2) exclude rows whose region is 'Ouest'; (3) exclude rows with fewer than 3 units; (4) line revenue = units * unit_price * (1 - discount_pct/100); (5) apply a tax of 5.0 % on the sum; (6) return the result rounded to 0 decimals (Python round). The current implementation forgets rule (2) and applies no tax.",29 "char_start": 20,30 "char_end": 62931 }32 ],33 "hidden_tests": [34 {35 "input": [36 {37 "region": "Nord",38 "product": "gamma",39 "units": 27,40 "unit_price": 77.4,41 "discount_pct": 15,42 "returned": false,43 "shipped_days": 1244 },45 {46 "region": "Centre",47 "product": "zeta",48 "units": 35,49 "unit_price": 53.2,50 "discount_pct": 0,51 "returned": false,52 "shipped_days": 553 },54 {55 "region": "Centre",56 "product": "gamma",57 "units": 19,58 "unit_price": 16.31,59 "discount_pct": 5,60 "returned": false,61 "shipped_days": 1362 },63 {64 "region": "Sud",65 "product": "gamma",66 "units": 24,67 "unit_price": 15.43,68 "discount_pct": 0,69 "returned": false,70 "shipped_days": 971 },72 {73 "region": "Centre",74 "product": "beta",75 "units": 25,76 "unit_price": 22.72,77 "discount_pct": 0,78 "returned": false,79 "shipped_days": 1280 },81 {82 "region": "Est",83 "product": "alpha",84 "units": 8,85 "unit_price": 15.98,86 "discount_pct": 15,87 "returned": false,88 "shipped_days": 689 },90 {91 "region": "Sud",92 "product": "beta",93 "units": 7,94 "unit_price": 62.36,95 "discount_pct": 10,96 "returned": false,97 "shipped_days": 1298 }99 ],100 "expected": 5641.0101 },102 {103 "input": [104 {105 "region": "Centre",106 "product": "epsilon",107 "units": 35,108 "unit_price": 25.05,109 "discount_pct": 5,110 "returned": false,111 "shipped_days": 12112 },113 {114 "region": "Nord",115 "product": "alpha",116 "units": 17,117 "unit_price": 30.38,118 "discount_pct": 0,119 "returned": false,120 "shipped_days": 9121 },122 {123 "region": "Nord",124 "product": "gamma",125 "units": 27,126 "unit_price": 77.4,127 "discount_pct": 15,128 "returned": false,129 "shipped_days": 12130 },131 {132 "region": "Sud",133 "product": "alpha",134 "units": 4,135 "unit_price": 32.63,136 "discount_pct": 0,137 "returned": true,138 "shipped_days": 14139 },140 {141 "region": "Centre",142 "product": "zeta",143 "units": 35,144 "unit_price": 53.2,145 "discount_pct": 0,146 "returned": false,147 "shipped_days": 5148 }149 ],150 "expected": 5237.0151 },152 {153 "input": [154 {155 "region": "Sud",156 "product": "alpha",157 "units": 4,158 "unit_price": 32.63,159 "discount_pct": 0,160 "returned": true,161 "shipped_days": 14162 },163 {164 "region": "Centre",165 "product": "gamma",166 "units": 19,167 "unit_price": 16.31,168 "discount_pct": 5,169 "returned": false,170 "shipped_days": 13171 },172 {173 "region": "Centre",174 "product": "zeta",175 "units": 35,176 "unit_price": 53.2,177 "discount_pct": 0,178 "returned": false,179 "shipped_days": 5180 },181 {182 "region": "Est",183 "product": "alpha",184 "units": 8,185 "unit_price": 15.98,186 "discount_pct": 15,187 "returned": false,188 "shipped_days": 6189 },190 {191 "region": "Centre",192 "product": "beta",193 "units": 25,194 "unit_price": 22.72,195 "discount_pct": 0,196 "returned": false,197 "shipped_days": 12198 },199 {200 "region": "Sud",201 "product": "beta",202 "units": 7,203 "unit_price": 62.36,204 "discount_pct": 10,205 "returned": false,206 "shipped_days": 12207 }208 ],209 "expected": 3387.0210 },211 {212 "input": [213 {214 "region": "Sud",215 "product": "beta",216 "units": 7,217 "unit_price": 62.36,218 "discount_pct": 10,219 "returned": false,220 "shipped_days": 12221 },222 {223 "region": "Est",224 "product": "alpha",225 "units": 8,226 "unit_price": 15.98,227 "discount_pct": 15,228 "returned": false,229 "shipped_days": 6230 },231 {232 "region": "Est",233 "product": "gamma",234 "units": 11,235 "unit_price": 16.91,236 "discount_pct": 0,237 "returned": false,238 "shipped_days": 11239 },240 {241 "region": "Centre",242 "product": "epsilon",243 "units": 35,244 "unit_price": 25.05,245 "discount_pct": 5,246 "returned": false,247 "shipped_days": 12248 },249 {250 "region": "Centre",251 "product": "beta",252 "units": 25,253 "unit_price": 22.72,254 "discount_pct": 0,255 "returned": false,256 "shipped_days": 12257 },258 {259 "region": "Ouest",260 "product": "delta",261 "units": 39,262 "unit_price": 68.27,263 "discount_pct": 0,264 "returned": false,265 "shipped_days": 13266 },267 {268 "region": "Centre",269 "product": "gamma",270 "units": 19,271 "unit_price": 16.31,272 "discount_pct": 5,273 "returned": false,274 "shipped_days": 13275 },276 {277 "region": "Est",278 "product": "zeta",279 "units": 13,280 "unit_price": 66.87,281 "discount_pct": 5,282 "returned": false,283 "shipped_days": 11284 }285 ],286 "expected": 3369.0287 },288 {289 "input": [290 {291 "region": "Est",292 "product": "gamma",293 "units": 11,294 "unit_price": 16.91,295 "discount_pct": 0,296 "returned": false,297 "shipped_days": 11298 },299 {300 "region": "Est",301 "product": "zeta",302 "units": 13,303 "unit_price": 66.87,304 "discount_pct": 5,305 "returned": false,306 "shipped_days": 11307 },308 {309 "region": "Centre",310 "product": "epsilon",311 "units": 35,312 "unit_price": 25.05,313 "discount_pct": 5,314 "returned": false,315 "shipped_days": 12316 },317 {318 "region": "Nord",319 "product": "gamma",320 "units": 27,321 "unit_price": 77.4,322 "discount_pct": 15,323 "returned": false,324 "shipped_days": 12325 },326 {327 "region": "Est",328 "product": "alpha",329 "units": 8,330 "unit_price": 15.98,331 "discount_pct": 15,332 "returned": false,333 "shipped_days": 6334 },335 {336 "region": "Ouest",337 "product": "delta",338 "units": 39,339 "unit_price": 68.27,340 "discount_pct": 0,341 "returned": false,342 "shipped_days": 13343 },344 {345 "region": "Centre",346 "product": "gamma",347 "units": 19,348 "unit_price": 16.31,349 "discount_pct": 5,350 "returned": false,351 "shipped_days": 13352 },353 {354 "region": "Nord",355 "product": "alpha",356 "units": 17,357 "unit_price": 30.38,358 "discount_pct": 0,359 "returned": false,360 "shipped_days": 9361 },362 {363 "region": "Sud",364 "product": "gamma",365 "units": 24,366 "unit_price": 15.43,367 "discount_pct": 0,368 "returned": false,369 "shipped_days": 9370 }371 ],372 "expected": 5156.0373 }374 ]375}