跳至主要內容

01-Hw-意大利

AI悦创原创PythonPython一对一教学Python一对一辅导Python 辅导编程一对一教学少儿编程一对一少儿编程一对一教学意大利Python一对一教学PythonPython一对一教学Python一对一辅导Python 辅导编程一对一教学少儿编程一对一少儿编程一对一教学意大利Python一对一教学大约 5 分钟...约 1627 字

The technical department of a large company has a number of PCs to lend out to employees in case of need(for example, when their PC in service or they are waiting to buy a new one).

一家大公司的技术部门有许多个人电脑借给员工以备不时之需(例如,当他们的个人电脑在使用中或他们正在等待购买一台新的电脑时)。

The list of all the PCs used for this purpose is contained in a text file parkPC.txt, which has on each line the unique identification code of a PC(*4-character alphanumeric). The PCs are not listed in any specific order.

用于此目的的所有PC的列表包含在一个文本文件parkPC.txt中,其中每行都有PC的唯一标识码(*4个字符的字母数字)。这些pc没有按任何特定的顺序列出。

A second text file records. txt reports all PC loans and returns sorted in chronological order. specifically, each line of the following information:

第二个文本文件记录。txt报告所有PC贷款和回报按时间顺序排序。具体来说,每一行的信息如下:

machineID:personID:data

machineID: personID:数据

machine ID:person ID:data

机器ID:人员ID:数据

Where machinelD is the identification code of the PC, personID is the unique serial number of the employee (a 6-digit string) who borrowed or returned the PC, date is the date of the loan or return, in dd/mm/yyyyy format. Note that:

其中machinelD为电脑的识别码,personID为借用或归还电脑的员工的唯一序列号(6位字符串),date为借用或归还电脑的日期,格式为dd/mm/yyyyy。注意:

  • The file does not distinguish in any way between loans and returns, so if the same machinelD:personiD pair appears on two successive dates,it means that the first time the PC was loaned, the second time it was returned. If the machinID:personiD pair appears only once, it means that theI PC is currently on loan to the employee personiD

其中machinelD为电脑的识别码,personID为借用或归还电脑的员工的唯一序列号(6位字符串),date为借用或归还电脑的日期,格式为dd/mm/yyyyy。注意:

  • an employee can have multiple active loans at the same time (obviously, loans from different PCs)

一个员工可以同时拥有多个活动贷款(显然,来自不同pc的贷款)

  • the same PC can be borrowed and returned multiple times, either by the same employee or by different employees;

同一台电脑可以被同一员工或不同员工多次借还;

  • a PC can only be lent to one employee at a time (i.e., it cannot be borrowed if it has not been returned first)

一台个人电脑一次只能借给一名员工(也就是说,如果电脑没有归还,就不能借)

Let us write a Python program that, once it reads the information contained in the two input files, prints it out on the monitor.

让我们编写一个Python程序,一旦它读取了包含在两个输入文件中的信息,就会将其打印到监视器上。

  1. the list, sorted by increasing serial number, of employees who have borrowed PCs that they have not yet returned. For each employee, we print the list of PC codes they currently have on loan, in alphabetical order.

这个名单,按序列号递增排序,列出了那些借用了电脑却还没有归还的员工。对于每个员工,我们按字母顺序打印出他们目前借出的PC代码列表。

  1. The list sorted by increasing serial number of PCs that are currently available for loan.Inopen in new window case all company PCs are on loan, the program should print the message "There are currently no PCs available for loan."

按当前可供借出的电脑序号递增排序。如果所有公司的电脑都被借出,该程序应该打印信息“ 目前没有可供借出的电脑。”

Records.txt
Q034:100123:31/01/2021
A123:100123:01/02/2021
A100:100123:01/02/2021
B088:123456:10/05/2021
A123:100123:15/06/2021
B088:123456:20/06/2021
A123:123456:21/07/2021
Z300:135987:22/01/2022
S100:100012:20/09/2022
  • Data types:数据类型
  • Numeric constants and variables数值常量和变量
  • Strings and their manipulation字符串和它们的操作
  • Input/Output of numbers and and strings数字和字符串的输入/输出
  • Arithmetic operators, powers, and mathematical functions算术运算符、幂和数学函数
  • Boolean variables and operators布尔变量和运算符
  • Control-flow structures (iterative and conditional) 控制流结构(迭代和条件)
  • Functions and calls函数和调用
  • Lists, Sets, and Dictionaries列表、集合和字典
  • Complex data structures (Dictionaries of sets and dictionaries of lists)
    复杂的数据结构(集合的字典和列表的字典)。
  • Text Files文本文件
  • Exceptions handling异常处理
公众号:AI悦创【二维码】

AI悦创·编程一对一

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh

C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh

方法一:QQopen in new window

方法二:微信:Jiabcdefh

上次编辑于:
贡献者: AI悦创
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度