国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

CSCA08代做、代寫Python設(shè)計(jì)編程

時(shí)間:2024-06-05  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



Assignment 1
CSCA08 Assignment 1: The Store
Due Date: June 14, 2024 at 6pm.
Goals of this Assignment
Use the Function Design Recipe (?wrap=1)
(/download?download_frd=1) to plan,
implement, and test functions.
Write function bodies using variables, numeric types, strings, and conditional statements. (You
can do this whole assignment with only the concepts from Weeks 1, 2, and 3 of the course.)
Learn to use Python 3, Wing 101, provided starter code, a checker module, and other tools.
Starter Code
For this assignment, you are provided some files, including Python starter code files. Please
download the Assignment 1 files (h?wrap=1)
(h/download?download_frd=1) and extract the zip
archive.
There are two starter code Python files and a Python program that helps you check (not fully
test!) your solutions for Python style violations:
store.py
This file contains some code that sets up your use of constants from constants.py, solutions
for some required functions for you to use as examples, as well as headers and docstrings
(but not bodies) for some functions you are required to write, to help you get started. Your
job is to complete this file.
constants.py
This file contains some useful constants that you should use in your solution. You will not
modify this file.
a1_checker.py
This is a checker program that you should use to check your code. See below for more
information.
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 1/10
Constants
Constants are special variables whose values should not change once assigned. A different
naming convention (uppercase pothole) is used for constants, so that programmers know to not
change their values. For example, in the starter code, the constant AGE is assigned the value of 4
and this value should never change in your code. When writing your code, if you need to use the
index at which a customer  s string representation contains their age, you should use AGE and not
the value 4. The same goes for the other constant values.
Using constants simplifies code modifications and improves readability and changeability. For
example, if we later decide to change the index at which a product  s string representation contains
their ID, we will only have to make the changes in one place, rather than throughout the program.
This also makes our code more readable.
You should read the file constants.py carefully to understand the purpose of each defined
constant. You must use these constants in your code and not the literal values. For example, you
must use AGE instead of 4 to earn full marks.
The Store
In this assignment, you will write functions to represent a store. In this store, there are products,
customers, and shopping lists.
A product is represented by a string, where each piece of the string will represent different bits of
information about the product. This string will contain the following information:
The product ID
How many of the product are available to purchase (current inventory)
What type of discount is associated with the product
The product  s price
A customer will also be represented by a string. This string will contain the following information:
The customer ID
The customer  s age
The customer  s budget
A shopping list will also be represented by a string, containing the following information:
A product ID
How many of the product to purchase
Products, customers, and shopping lists
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 2/10
A valid product will have 12 characters. The index ranges of a product are explained below:
Characters at indices from PID to PID+3, inclusive, represent the product ID. These four
characters will be digits.
Characters at indices from INV to INV+1, inclusive, represent the current product inventory.
These two characters will be digits. For single-digit inventories, the character at the index INV
will be   0  .
Characters at indices from DISC to DISC+2, inclusive, represent the type of discount for this
product. These 3 characters will be letters. Specifically, there are 4 types of discounts, each
relevant for a specific customer age range (in years, inclusive):   ALL   (any age),   TEE   (13-19),
  SEN   (65+), and   NON   (no discount at all). Each of these discounts will apply the discount
rate, DISCOUNT_RATE.
Characters at indices PRICE to PRICE+2, inclusive, represent the product  s price. These three
characters will be digits. For single-digit prices, the characters from indices PRICE to
PRICE+1, inclusive, will be   00  . For double-digit prices, the character at index PRICE will be
  0  .
A couple examples of valid products below:
Assuming PID = 0, INV = 4, DISC = 6, PRICE = 9, a product represented by
  372**8ALL1**   has an ID of   3729  , a current inventory of 8, will be discounted for
customers of any age, and is priced at $1**.
Assuming PID = 5, INV = 3, DISC = 9, PRICE = 0, a product represented by
  0**9**184TEE   has an ID of   0184  , a current inventory of 99, will be discounted for
customers between the ages of 13-19, inclusive, and is priced at $**.
A valid customer will have 9 characters. The index ranges of a customer are explained below:
Characters at indices from CID to CID+3, inclusive, represent the customer ID. These four
characters will be letters.
Characters at indices from AGE to AGE+1, inclusive, represent the customer  s age. These two
characters will be digits. For single-digit ages, the character at the index AGE will be   0  .
Characters at indices from BUDGET to BUDGET+2, inclusive, represent the customer  s
budget. These 3 characters will be digits. For single-digit budgets, the characters from indices
BUDGET to BUDGET+1, inclusive, will be   00  . For double-digit budgets, the character at
index BUDGET will be   0  .
A couple examples of valid customers below:
Assuming CID = 0, AGE = 4, BUDGET = 6, a customer represented by   MARK17008   has
an ID of   MARK  , is 17 years old, and has a budget of $8.
Assuming CID = 5, AGE = 0, BUDGET = 2, a customer represented by   64999ABCD   has
an ID of   ABCD  , is 64 years old, and has a budget of $999.
A valid shopping list will have 6 characters. The index ranges of a shopping list are explained
below:
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 3/10
Characters at indices from SPID to SPID+3, inclusive, represent the product ID. These four
characters will be digits.
Characters at indices from PURCHASE_NUM to PURCHASE_NUM+1, inclusive, represent
how many of the product to purchase. These two characters will be digits. For single-digit
purchases, the character at the index PURCHASE_NUM will be   0  .
A couple examples of valid shopping lists below:
Assuming SPID = 0, PURCHASE_NUM = 4, a shopping list represented by   018427   asks
to buy 27 of the product with an ID of   0184  .
Assuming SPID = 2, PURCHASE_NUM = 0, a shopping list represented by   043309   asks
to buy 4 of the product with an ID of   3309  .
What to do
In the starter code file store.py, complete the following function definitions. Note that some are
already provided for you to use as examples! Use the Function Design Recipe that you have
been learning in this course. We have included the type contracts in the following table; please
read through the table to understand how the functions will be used.
We will be evaluating your docstrings in addition to your code. You must include at least two
examples in each docstring. You will need to paraphrase the full descriptions of the functions to
get an appropriate docstring description. Your docstring examples should be valid doctests    we
will run them as part of the evaluation of your program.
Functions to write for A1
Function Name:
(Parameter types) ->
Return type
Description (paraphrase to get a proper
docstring description)
get_pid:
(str) -> str
The parameter represents a product. The
function should return the ID of the given
product.
You may assume the given product is valid.
get_inventory:
(str) -> int
The parameter represents a product. The
function should return the current inventory of
the given product.
You may assume the given product is valid.
get_discount: The parameter represents a product. The
function should return the type of discount for
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 4/10
(str) -> str the given product.
You may assume the given product is valid.
get_price:
(str) -> int
The parameter represents a product. The
function should return the price of the given
product.
You may assume the given product is valid.
get_cid:
(str) -> str
The parameter represents a customer. The
function should return the ID of the given
customer.
You may assume the given customer is valid.
get_age:
(str) -> int
The parameter represents a customer. The
function should return the age of the given
customer.
You may assume the given customer is valid.
get_budget:
(str) -> int
The parameter represents a customer. The
function should return the budget of the given
customer.
You may assume the given customer is valid.
get_spid:
(str) -> str
The parameter represents a shopping list.
The function should return the product ID of
the given shopping list.
You may assume the given shopping list is
valid.
get_purchase_num:
(str) -> int
The parameter represents a shopping list.
The function should return how many of the
product to purchase for the given shopping
list.
You may assume the given shopping list is
valid.
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 5/10
check_discount_eligibility:
(str, str) -> bool
The first parameter represents a product. The
second parameter represents a customer.
The function should return True if and only if
this customer is eligible for a discount on this
product.
You may assume the given product and
customer are valid.
calc_discounted_price:
(str, str) -> int
The first parameter represents a product. The
second parameter represents a customer.
The function should return the price of the
given product after any discounts the given
customer is eligible for, rounded to the
nearest integer.
You may assume the given product and
customer are valid.
calc_total_price:
(str, str, str) -> int
The first parameter represents a product. The
second parameter represents a customer.
The third parameter represents a shopping
list. This function should return the total price
of the given product after any discounts this
customer is eligible for, according to the
number of products noted on the given
shopping list, rounded to the nearest integer.
You may assume the given product,
customer, and shopping list are valid. You
may assume the given product has the same
ID as the product ID on the given shopping
list.
Hint: use your completed
calc_discounted_price function.
check_available_inventory:
(str, str) -> bool
The first parameter represents a product. The
second parameter represents a shopping list.
This function should return True if and only if
the store has enough current inventory of the
given product to fulfil the amount of it to be
bought on the given shopping list.
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 6/10
You may assume the given product and
shopping list are valid. You may assume the
given product has the same ID as the product
ID on the given shopping list.
within_budget:
(str, str, str) -> bool
The first parameter represents a product. The
second parameter represents a customer.
The third parameter represents a shopping
list. This function should return True if and
only if the given customer has enough budget
to purchase the amount of the given product
on their given shopping list.
You may assume the given product,
customer, and shopping list are valid. You
may assume the given product has the same
ID as the product ID on the given shopping
list.
checkout:
(str, str, str) -> bool
The first parameter represents a product. The
second parameter represents a customer.
The third parameter represents a shopping
list. This function should return True if and
only if the given customer can successfully
check out, ie the given customer has enough
budget to purchase the amount of the given
product on their given shopping list and there
is enough current inventory of the given
product in the store.
You may assume the given product,
customer, and shopping list are valid. You
may assume the given product has the same
ID as the product ID on the given shopping
list.
change_inventory:
(str, str) -> str
The first parameter represents a product. The
second parameter represents a shopping list.
This function returns a new product string in
the same format as the given product with an
updated inventory based on how many of the
product are being bought as per the given
shopping list. If there isn  t enough inventory,
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 7/10
the purchase will not be made, ie the
inventory should not change.
You may assume the given product and
shopping list are valid. You may assume the
given product has the same ID as the product
ID on the given shopping list.
change_price:
(str, int) -> str
The first parameter represents a product. The
second parameter represents a price. This
function returns a new product string in the
same format as the given product with an
updated price, as given.
You may assume the given product is valid.
You may assume the given price is valid for a
product string.
compare_products:
(str, str) -> str
The first parameter represents a product,
  product1  . The second parameter represents
another product,   product2  . This function
returns the product ID of the   better   of the
two given products.   product1   is the   better  
product if and only if:
Each digit of   product1    s ID is greater
than the respective digit of   product2    s ID,
except for the third digit
The current inventory of   product1   is at
least as much as the current inventory of
  product2  
The price of   product1   is lower than that
of   product2  
You may assume the given products are
valid.
Using Constants
As we discuss in section Constants above, your code should make use of the provided constants.
If the value of one of those constants were changed, and your program rerun, your functions
should work with those new values.
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 8/10
For example, if AGE were changed, then your functions should work according to the new index at
which a customer  s age is stored in their string representation. Using constants in your code
means that this happens automatically.
Your docstring examples should reflect the given values of the constants in the provided starter
code, and do not need to change.
No Input or Output
Your store.py file should contain the starter code, plus the function definitions specified
above. store.py must not include any calls to the print and input functions. Do not add
any import statements. Also, do not include any function calls or other code outside of the function
definitions.
A1 Checker
We are providing a checker module (a1_checker.py) that tests two things:
whether your code follows the Python style guidelines
(https://www.utsc.utoronto.ca/~atafliovich/csca08/assignments/a1/python_style_guide.html) , and
whether your functions are named correctly, have the correct number of parameters, and
return the correct types.
To run the checker, open a1_checker.py and run it. Note: the checker file should be in
the same directory as your store.py, as provided in the starter code zip file. Be sure to scroll up to
the top and read all the messages!
If the checker passes for both style and types:
Your code follows the style guidelines.
Your function names, number of parameters, and return types match the assignment
specification. This does not mean that your code works correctly in all situations. We will
run a different set of tests on your code once you hand it in, so be sure to thoroughly test your
code yourself before submitting.
If the checker fails, carefully read the message provided:
It may have failed because your code did not follow the style guidelines. Review the error
description(s) and fix the code style. Please see the PyTA documentation
(https://www.cs.toronto.edu/~david/pyta/) for more information about errors.
It may have failed because:
you are missing one or more functions,
one or more of your functions are misnamed,
one or more of your functions have incorrect number or types of parameters, or
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 9/10
one of more of your functions return values of types that do not match the assignment
specification.
Read the error messages to identify the problematic functions, review the function specifications
in the handout, and fix your code.
Make sure the checker passes before submitting.
Marking
These are the aspects of your work that may be marked for A1:
Coding style (20%):
Make sure that you follow Python style guidelines
(https://www.utsc.utoronto.ca/~atafliovich/csca08/assignments/a1/python_style_guide.html)
that we have introduced and the Python coding conventions that we have been using
throughout the semester. Although we do not provide an exhaustive list of style rules, the
checker tests for style are complete, so if your code passes the checker, then it will earn
full marks for coding style with one exception: docstrings will be evaluated separately. For
each occurrence of a PyTA error, one mark (out of 20) deduction will be applied. For
example, if a C0301 (line-too-long) error occurs 3 times, then 3 marks will be deducted.
All functions, including helper functions, should have complete docstrings including
preconditions when you think they are necessary and at least two valid examples.
Correctness (80%):
Your functions should perform as specified. Correctness, as measured by our tests, will count for
the largest single portion of your marks. Once your assignment is submitted, we will run additional
tests not provided in the checker. Passing the checker does not mean that your code will earn full
marks for correctness.
Note that for full marks all docstring examples you provide should run without producing
errors.
What to hand in
The very last thing you do before submitting should be to run the checker program one
last time.
Otherwise, you could make a small error in your final changes before submitting that causes your
code to receive zero for correctness.
Submit store.py on MarkUs (this will become available soon!). Remember that spelling of
filenames, including case, counts: your file must be named exactly as above.
 Assignment 1: CSCA08H3 Y LEC01 20245:Introduction to Computer Science I
 10/10

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp
















 

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:越南簽證過期去哪里續(xù)簽(越南簽證續(xù)簽過程)
  • 下一篇:8IAR101代做、python設(shè)計(jì)編程代寫
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手,多多出評軟件徽y1698861
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 寵物飼養(yǎng) 十大衛(wèi)浴品牌排行 suno 豆包網(wǎng)頁版入口 wps 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    久久这里只有精品8| 久久综合电影一区| 美媛馆国产精品一区二区| 日本一区二区三区四区视频 | 久久96国产精品久久99软件| 国产九色精品| 99久久国产宗和精品1上映| 91免费看蜜桃| 国产高清在线一区二区| 久久久久久久久久久99| 国产精品无码电影在线观看| 久久艳片www.17c.com| 国产99午夜精品一区二区三区| 久久69精品久久久久久久电影好| 一区二区三区四区在线视频| 亚洲精品影院| 日本高清不卡三区| 欧美 日韩 亚洲 一区| 精品日韩在线播放| 成人av中文| 久久免费一区| 国产精品视频免费一区二区三区| 国产精品久久久久高潮| 中文字幕成人一区| 日韩精品久久一区二区| 蜜桃视频成人在线观看| 国产精品亚洲一区二区三区| 久久偷窥视频| 国产精品毛片va一区二区三区| 自拍视频一区二区三区| 日韩视频在线免费播放| 国产主播一区二区三区四区| 成人av男人的天堂| 国产成人精品久久亚洲高清不卡 | 操人视频欧美| 国产成人精品免高潮在线观看| www.日韩av.com| 色综合天天综合网国产成人网| 欧美一区二区三区电影在线观看| 欧美激情国产日韩| 成人av播放| 久久精品国产电影| 亚洲一区二区在线免费观看| 欧美在线观看黄| 成人av电影免费| 久久激情视频久久| 亚州精品天堂中文字幕| 国产一区二区中文字幕免费看| 不卡中文字幕在线| 日韩亚洲欧美中文高清在线| 在线视频欧美一区| 欧美大香线蕉线伊人久久国产精品| 国产精品亚洲一区| 国产精品丝袜视频| 日韩一区二区高清视频| 美女精品国产| 久久观看最新视频| 亚洲最大福利视频网站| 狠狠干 狠狠操| 国产成人精品av| 亚洲制服欧美久久| 麻豆亚洲一区| 久久精品国产69国产精品亚洲| 午夜视频在线瓜伦| 国产三区精品| 精品国产一区二区三区四区在线观看 | 91国内在线视频| 国产精品视频久| 日本久久久网站| 91黄在线观看| 亚洲一区中文字幕| 成人免费淫片aa视频免费| 久久天天躁夜夜躁狠狠躁2022| 欧美性受xxxx黑人猛交| 国产厕所精品在线观看| 亚洲va韩国va欧美va精四季| 不卡一卡2卡3卡4卡精品在| 美女视频久久黄| 国产在线不卡精品| 国产精品对白一区二区三区| 精品日产一区2区三区黄免费| 国产激情片在线观看| 在线观看欧美一区| 国产九色porny| 久久不射电影网| 国模吧一区二区| 国产精品久久久影院| 欧美精品久久96人妻无码| 日韩在线中文字幕| 欧美亚洲国产免费| 久久精品亚洲国产| 激情伊人五月天| 国产精品国产自产拍高清av水多 | 久久久在线观看| 亚洲在线色站| 91精品国产91久久久久青草| 亚洲精品成人三区| 国产成人精品999| 欧美一区观看| 国产精品久久久久免费| 精品一区久久| 一区二区三区欧美在线| 69精品小视频| 日韩美女免费线视频| 久久视频精品在线| 国产日韩欧美中文在线播放| 一区二区三区国产福利| 91九色视频在线| 日韩wuma| 俺去啦;欧美日韩| 国内成人精品一区| 精品国产aⅴ麻豆| 91久久在线视频| 日韩久久不卡| 欧美精品在线看| 91av在线不卡| 欧美精品一区二区视频| 欧美激情国产日韩精品一区18| 97人人爽人人喊人人模波多| 日韩不卡一二区| 国产精品美乳一区二区免费| 国产精品一区在线播放| 日本成人精品在线| 欧美精品在线视频观看| 99久re热视频精品98| 日韩三级在线播放| 久热精品在线视频| 久久琪琪电影院| 国模吧无码一区二区三区| 亚洲高潮无码久久| 国产成人精品在线观看| 国产乱码精品一区二区三区卡| 欧美一区二区三区综合| 国产精品国产三级国产专播精品人| www.亚洲一区二区| 欧美视频在线播放一区| 一区二区不卡视频| 国产精品日韩欧美大师| 91精品国产九九九久久久亚洲 | 日韩一中文字幕| 成人一级生活片| 青青草原av在线播放| 久久99视频精品| 国产成人精品在线播放| 97精品国产97久久久久久春色| 青青在线免费视频| 一本久道久久综合狠狠爱亚洲精品| 日韩在线视频免费观看高清中文| 国产欧美一区二区三区在线| 热门国产精品亚洲第一区在线| 综合一区中文字幕| 国产精品免费入口| 国产高清自拍一区| www.com毛片| 狠狠色狠狠色综合人人| 日本a在线天堂| 亚洲激情免费视频| 精品国产中文字幕| 日日摸夜夜添一区| 精品一区二区中文字幕| 青青青在线观看视频| 亚洲www永久成人夜色| 欧美精品在线播放| 国产精品日本一区二区| 日韩一区二区精品视频| 国产福利视频在线播放| 国产精品一区二区3区| 免费在线a视频| 青青草国产免费| 欧美一区2区三区4区公司二百| 一本一本a久久| 欧美精品xxx| 精品中文字幕在线观看| 国产精品高潮呻吟久久av黑人| www.日韩.com| 日韩亚洲欧美中文在线| 国产精品久久久久久久app | 色噜噜一区二区| 亚洲一区免费看| 久久国产精品久久久久| 久久香蕉国产线看观看网| 国产精品视频xxxx| 久久综合伊人77777蜜臀| 日韩在线视频网站| www.欧美三级电影.com| 久久久久久伊人| www.久久久久| 久久精品国产99国产精品澳门| 日韩视频在线免费| 国产精品三区www17con| 国产精品久久久久影院日本| 国产精品久久久久久久久电影网| 国产精品久久国产| 精品久久久久久亚洲| 国产99午夜精品一区二区三区| 久久99久久99精品中文字幕| 久久久久久12| 无码人妻精品一区二区三区66| 天天干天天操天天干天天操| 日日摸天天爽天天爽视频|