fork download
  1. print("--- AI训练常用工具 ---") # 增加行1:打印标题
  2. tools = ["TensorFlow", "PyTorch", "Keras"]
  3. print("初始工具列表:", tools )
  4. print("当前工具数量:", len(tools) ) # 增加行2:打印列表长度
  5. print("\n--- 添加新工具 ---")
  6. new_tools = ["Scikit-learn", "MXNet"]
  7. for tool in new_tools:
  8. if tool not in tools:
  9. tools. append (tool)
  10. else:
  11. print(f"工具 '{tool}' 已存在,跳过添加")
  12.  
  13. print("\n更新后的工具列表:", tools )
  14. print("\n更新后的工具列表数量:", len(tools ) )
Success #stdin #stdout 0.08s 14076KB
stdin
Standard input is empty
stdout
--- AI训练常用工具 ---
初始工具列表: ['TensorFlow', 'PyTorch', 'Keras']
当前工具数量: 3

--- 添加新工具 ---

更新后的工具列表: ['TensorFlow', 'PyTorch', 'Keras', 'Scikit-learn', 'MXNet']

更新后的工具列表数量: 5