Assignment3
Submission instructions
- You should submit your homework on GitHub.
- For this assignment you should turn in 4 separate
.py
files named according to the following pattern:hw1_q1.py
,hw1_q2.py
, etc. - Each Python file you submit should contain a header comment block as follows:
"""
Author: [Your name here]
Assignment / Part: HW1 - Q1 (etc.)
Date due: 2023-02-09, 11:59pm
I pledge that I have completed this assignment without
collaborating with anyone else, in conformance with the
Bornforthis 1v1 School of Computer Science and Procedures on
Academic Misconduct.
"""
No late submissions will be accepted.
REMINDER: Do not use any Python structures that we have not learned in class.
注意
下面英文有可能表述没那么到位,如果感觉英文表达有优化的地方,欢迎在评论区留言指出来哈。不胜感激~
Question 1:
Task 1: Personal Information Security
- Provide a tuple containing a name, date of birth, and email.
- Students need to extract the name and email and create a new tuple that excludes the date of birth.
Here are the assignments translated into English, each designed around a mini-project to help students learn and apply basic Python knowledge using tuples, strings, variables, numbers, and lists:
Task 1: Country and Capital Pairing
- Create a tuple that contains multiple sub-tuples, each consisting of a country and its capital (e.g., (
"China"
,"Beijing"
)). - Students need to extract all the countries and capitals and store them into two separate lists.
Task 2: Product Price Tagging
Create a tuple that includes the names and prices of various products.
Students are required to extract the names and prices and then create a string formatted as: "Product Name: Price".
Task 4: Weather Forecast
- Create a tuple containing the highest temperature for each day of the week.
- Students need to calculate the average highest temperature for the week and output it.
Task 5: ISBN Verification
- Given a tuple containing book names and their ISBNs.
- Students need to extract the ISBN and check whether it conforms to the standard format of 10 or 13 digits.
Task 6: Movie Ratings
- Create a tuple containing several movies and their respective ratings (from 1 to 5 stars).
- Students need to find out the highest-rated movie name and its rating.
Task 7: Student Grade Report
- Provide a tuple containing students' names and their grades.
- Students need to output a string formatted as: "Name: Grade".
Task 8: Recipe Ingredient Proportions
- Create a tuple containing the names of ingredients and their proportions needed to make a specific dish.
- Students need to output all ingredients and their proportions formatted as "Ingredient: Proportion".
Task 9: Vehicle Information Encoding
- Provide a tuple containing the type of vehicle, maximum speed, and color.
- Students need to create a string describing the vehicle, such as: "This is a red car with a maximum speed of 120 km/h".
Task 10: Vacation Planning
- Create a tuple containing several destinations and the recommended number of days to stay at each.
- Students need to create a travel plan formatted as "Destination: Suggested Number of Days".
These tasks help students understand and practically manipulate tuples, lists, strings, and variables while keeping learning fun and practical without using complex Python syntax.
欢迎关注我公众号:AI悦创,有更多更好玩的等你发现!
公众号:AI悦创【二维码】
AI悦创·编程一对一
AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh
C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh
方法一:QQ
方法二:微信:Jiabcdefh