AIC2100代写、Python设计程序代做
Lab 1
Byungjoo Lee
Yonsei University
AIC2100 AI Programming with Python
Lab 1 AIC2100
2
You must follow the specification thorougly!
• Any typos (including whitespace and linebreak) will result in a point deduction.
• If you’re asked to write the comment or docstring, you must add them.
• If some Python libraries are prohibited, importing them will result in 0 points.
• Depending on the lab content, additional rules can be added.
• Please read the specification document carefully and submit your code.
• We won't accept appeals for point deductions based on misinterpreting the lab specification
documentation.
• If any specification is unclear, please post your question on the Q&A board.
Lab 1 AIC2100
3
Please refer to the guidelines noted in previous labs. They remain applicable for this and
subsequent labs.
Any updates in guidelines will be announced again.
Coding guideline
Lab 1 AIC2100
4
Notation
• To clearly instruct the lab specifications, (1) we use “˽” to depict a whitespace (blank)
character and (2) “¤” for a “\n” (newline) character.
• Underlined text refers to the user input (will be demonstrated again in a further lab).
• New notations will be demonstrated additionally on there first mention.
Lab 1 AIC2100
5
One important note about automated archiving
• In lab0, the automated archive code used the incorrect folder name format “{student_id}”.
• It should have been “lab{X}_{student_id}”. (Sorry)
• Don’t worry, we did not deduct your point with this since it is our mistake.
• In the slides explaning the automated archive code (ap_lab0.pdf p.15-16), we specified the
wrong format, while in the slide explaning manual archiving (p. 17), we specified the correct
format.
• We revised the code and update it to LearnUs, even though it is outdated.
• TL;DR
• If you want to use automated archiving, just use our provided code. You don’t need to
revise it on your own.
• If you manually archived in Lab 0, “lab{X}_{student_id}” foldername is correct.
Lab 1 AIC2100
6
Problem 1
Write a program that allows the user to enter any integer base and integer exponent, and displays
the value of the base raised to that exponent. Your program should work as shown below.
Note 1. You do not have to consider faulty input. More specifically, we will test your program for
integer inputs only.
Note 2. The integer base and exponent will be non-negative.
This program needs to ask two times for input from the user. The input prompt with the second
input() command depends on the input from the first input() command. This is highlighted in the
following example:
What˽base?˽10¤
What˽power˽of˽10?˽4¤
10˽to˽the˽power˽of˽4˽is˽10000¤
Lab 1 AIC2100
7
Problem 1
Here are some examples.
What˽base?˽0¤
What˽power˽of˽0?˽5¤
0˽to˽the˽power˽of˽5˽is˽0¤
What˽base?˽2¤
What˽power˽of˽2?˽10¤
2˽to˽the˽power˽of˽10˽is˽1024¤
What˽base?˽5¤
What˽power˽of˽5?˽0¤
5˽to˽the˽power˽of˽0˽is˽1¤
What˽base?˽-25¤
What˽power˽of˽-25?˽3.7¤
You don’t need to consider non-integer inputs.
Lab 1 AIC2100
8
Problem 1
FAQ
Q. What is 0
0?
A. Mathematically, it converges to 1 and Python will output 1 too.
Lab 1 AIC2100
9
Problem 2
Write a program that allows the user to enter a base integer and a four-digit number, and displays
its value in base 10. Each digit should be entered one per line, starting with the leftmost digit, as
shown below. This program also needs to ask several times for input from the user. The output
depends on the input from input() command. This is highlighted in the following example:
Enter˽the˽base˽integer:˽2¤
Enter˽leftmost˽digit:˽1¤
Enter˽the˽next˽digit:˽0¤
Enter˽the˽next˽digit:˽0¤
Enter˽the˽last˽digit:˽1¤
Your˽input˽is˽1001˽in˽base˽2¤
The˽value˽is˽9˽in˽base˽10¤
Example 1
Enter˽the˽base˽integer:˽5¤
Enter˽leftmost˽digit:˽0¤
Enter˽the˽next˽digit:˽3¤
Enter˽the˽next˽digit:˽4¤
Enter˽the˽last˽digit:˽2¤
Your˽input˽is˽0342˽in˽base˽5¤
The˽value˽is˽97˽in˽base˽10¤
Example 2
Lab 1 AIC2100
10
Problem 2
Note 1. You can assume that the base integer is integer from 2 to 10 and four-digit numbers are
non-negative integers.
Note 2. You do not have to consider faulty inputs. There are two cases.
- Invalid base integer input (non-integer or out-of-range)
- Invalid four-digit number (non-integer or exceeding base integer)
Note 3. You don’t need to omit starting zeros when printing your input digit numbers (e.g., if your
input is 0011, then print 0011, not 11). See example 2 in the previous slide.
Lab 1 AIC2100
11
Problem 3
Write a program in which the user can enter any number of positive and negative integer values,
that displays the number of positive values entered and their summation, as well as the negative
values. Your program should work in following conditions.
1. Exclude all numbers that aboslute value is greater than 100 (i.e., 𝑥 > 100).
2. Your program should stop taking the user input and print the results when 0 is entered.
3. The format of printed output differs by whether the number of entered positive/negative integer
is 0 or not.
4. You don’t need to consider faulty inputs (non-integer or -0).
Hint. You can use sum() function.
See the examples on the next slides.
Lab 1 AIC2100
12
Problem 3
Your˽number:˽5¤
Your˽number:˽-32¤
Your˽number:˽105¤
Your˽number:˽31¤
Your˽number:˽-52¤
Your˽number:˽-25234¤
Your˽number:˽0¤
There˽are˽2˽positive˽integer(s)˽and˽the˽sum˽is˽36¤
There˽are˽2˽negative˽integer(s)˽and˽the˽sum˽is˽-84¤
Example 1 – Normal case
Lab 1 AIC2100
13
Problem 3
Your˽number:˽5¤
Your˽number:˽-1002¤
Your˽number:˽15¤
Your˽number:˽31¤
Your˽number:˽0¤
There˽are˽3˽positive˽integer(s)˽and˽the˽sum˽is˽51¤
No˽negative˽integer˽entered¤
Example 2 – Empty negative integer list
Lab 1 AIC2100
14
Problem 3
Your˽number:˽-22¤
Your˽number:˽12345¤
Your˽number:˽-99¤
Your˽number:˽-6¤
Your˽number:˽0¤
No˽positive˽integer˽entered¤
There˽are˽3˽negative˽integer(s)˽and˽the˽sum˽is˽-127¤
Example 3 – Empty positive integer list
Lab 1 AIC2100
15
Problem 3
Your˽number:˽0¤
No˽positive˽integer˽entered¤
No˽negative˽integer˽entered¤
Example 4 – Immediate termination
Lab 1 AIC2100
16
Problem 4
Write a program that calculates the least common multiple (LCM, 최소공배수) of two input positive
integer.
Note 1. You can assume that the input integers are always greater than 1.
Note 2. You do not have to consider faulty inputs.
Note 3. You are not allowed to use any library (including standard one)
Hint 1. Find the greatest common divisor (GCD, 최대공약수) first.
Hint 2. LCM can be computed as the multiple of two integers divided by their GCD.
To compute GCD, we strongly suggest you to use Euclidean algorithm (유클리드 호제법).
Lab 1 AIC2100
17
Problem 4
Input˽integer˽1:˽3¤
Input˽integer˽2:˽4¤
The˽least˽common˽multiple˽of˽3˽and˽4˽is˽12¤
Input˽integer˽1:˽16¤
Input˽integer˽2:˽36¤
The˽least˽common˽multiple˽of˽16˽and˽36˽is˽144¤
Input˽integer˽1:˽1024¤
Input˽integer˽2:˽395¤
The˽least˽common˽multiple˽of˽1024˽and˽395˽is˽404480¤
Input˽integer˽1:˽72¤
Input˽integer˽2:˽80¤
The˽least˽common˽multiple˽of˽72˽and˽80˽is˽720¤
Lab 1 AIC2100
18
Problem 5
Write a program that displays how many images can be stored on a given size USB drive. The
size of the USB drive is to be entered by the user in gigabytes (GB). The number of images that
can be stored must be calcaulted for GIF, JPEG, PNG, and TIFF image file formats. Follow the
below output format.
There are several notes you should follow in this problem.
Enter˽USB˽size˽(GB):˽1¤
˽11184˽image(s)˽in˽GIF˽format˽can˽be˽stored¤
˽18641˽image(s)˽in˽JPEG˽format˽can˽be˽stored¤
˽˽5965˽image(s)˽in˽PNG˽format˽can˽be˽stored¤
˽˽˽372˽image(s)˽in˽TIFF˽format˽can˽be˽stored¤
Lab 1 AIC2100
19
Problem 5
Assumption 1: All the images have a resolution of 800×600 pixels.
Assumption 2: The compression rate and color depth of each image format is set as below table.
Follow these steps to compute the total number of bytes required to sotre 1 image.
1. Compute number of pixels.
2. Compute number of bytes to represent lossless image (i.e., multiply color depth byte)
3. Compress the image (i.e., divide it by compress rate).
Format Color depth Compression
GIF 1 byte 5:1
JPEG 3 byte 25:1
PNG 3 byte 8:1
TIFF 6 byte 1:1 (n/a)
Lab 1 AIC2100
20
Problem 5
Note 1. Do not report partial images (e.g., 5.5 images). The number of image must be integer.
Note 2. You are allowed to use Python 3 math module (it is standard library) for this problem only.
Note 3. Assume that 1GB is 2
30 bytes.
Note 4. You can assume that USB size input is always positive integer.
Note 4. The number of images should be displayed in 6-digit fieldwidth (see example in slide 18)
Note 5. For larger USB drives, a fieldwidth of 6 may be insufficient to accommodate the number of
images. In such a case it is permissible to exceed the 6-digit fieldwidth (see below example).
Enter˽USB˽size˽(GB):˽64¤
715827˽image(s)˽in˽GIF˽format˽can˽be˽stored¤
1193046˽image(s)˽in˽JPEG˽format˽can˽be˽stored¤
381774˽image(s)˽in˽PNG˽format˽can˽be˽stored¤
˽23860˽image(s)˽in˽TIFF˽format˽can˽be˽stored¤
Lab 1 AIC2100
21
Marking Criteria
• Score is only given to programs that compile and produce the correct output with Python version
3.
• No points for programs that are named wrongly. Please refer to the following slide for the
required file names.
• Points are deducted for programs that produce warnings.
• Please pay particular attention to the requested output format of your programs. Deviating from
the requested output format results in points deductions.
Lab 1 AIC2100
22
Plagiarism
• Plagiarism (Cheating)
– This is an individual assignment. All or some submissions are checked for plagiarism.
• We will not inform you which problems will be checked.
– Once detected, measures will be taken for all students involved in the plagiarism incident
(including the ``source'' of the plagiarized code).
Lab 1 AIC2100
23
• Please prepare the files for the programming problems. The names of the files, their due
dates, and the archive file names are given in the table above.
• Please upload your archive file by the stated due date on LearnUs.
• Please pay attention to file names.
• Putting files into archives has been explained in the Lab 0 specification.
Deliverables, Due Date and Submission
Problem File name Due Archive name
1 lab1_p1.py
Monday
April 8, 2024,
23:59
lab1_.zip
2 lab1_p2.py
3 lab1_p3.py
4 lab1_p4.py
5 lab1_p5.py

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图