fork download
  1. # your code goes here# your code goes here
  2. print("--- AI训练常用工具 ---")
  3. tools = ["TensorFlow", "PyTorch", "Keras"]
  4. print("初始工具列表:", tools)
  5. print("当前工具数量:", len(tools))
  6. print("每个工具名称:")
  7. for t in tools:
  8. print(" -", t)
  9.  
  10. print("--- AI训练常用工具 ---")
  11. tools = ["TensorFlow", "PyTorch", "Keras"]
  12. print("初始工具列表:", tools)
  13. print("当前工具数量:", len(tools))
  14. print("每个工具名称:")
  15. for t in tools:
  16. print(" -", t)
  17.  
  18. print("\n--- 添加新工具 ---")
  19. new_tools = ["Scikit-learn", "MXNet"]
  20. for tool in new_tools:
  21. if tool not in tools:
  22. tools.append(tool)
  23. else:
  24. print(f"工具 '{tool}' 已存在,跳过添加")
  25. print("\n更新后的工具列表:", tools)
Success #stdin #stdout 0.06s 14144KB
stdin
Standard input is empty
stdout
--- AI训练常用工具 ---
初始工具列表: ['TensorFlow', 'PyTorch', 'Keras']
当前工具数量: 3
每个工具名称:
 - TensorFlow
--- AI训练常用工具 ---
 - PyTorch
--- AI训练常用工具 ---
 - Keras
--- AI训练常用工具 ---
初始工具列表: ['TensorFlow', 'PyTorch', 'Keras']
当前工具数量: 3
每个工具名称:
 - TensorFlow

--- 添加新工具 ---
 - PyTorch

--- 添加新工具 ---
 - Keras

--- 添加新工具 ---

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