题目:

Happy Holidays fellow Code Warriors!

Santa's senior gift organizer Elf developed a way to represent up to 26 gifts by assigning a unique alphabetical character to each gift. After each gift was assigned a character, the gift organizer Elf then joined the characters to form the gift ordering code.

Santa asked his organizer to order the characters in alphabetical order, but the Elf fell asleep from consuming too much hot chocolate and candy canes! Can you help him out?

Sort the Gift Code

Write a function called sortGiftCode/sort_gift_code/SortGiftCode that accepts a string containing up to 26 unique alphabetical characters, and returns a string containing the same characters in alphabetical order.

Examples:

sort_gift_code( 'abcdef' ) # 'abcdef' sort_gift_code( 'pqksuvy' ) # 'kpqsuvy' sort_gift_code( 'zyxwvutsrqponmlkjihgfedcba' ) # 'abcdefghijklmnopqrstuvwxyz'

解题方法:

def sort_gift_code(code):
return "".join(sorted(code))

最新文章

  1. mysql乐观锁总结和实践--转
  2. Effective c++读书笔记
  3. 【转】JavaScript获取节点类型、节点名称和节点值
  4. .Net分布式异常报警系统-服务端站点管理
  5. PHP常用字符串操作函数实例总结(trim、nl2br、addcslashes、uudecode、md5等)
  6. SpringMVC 配置log4j
  7. iOS7自定义statusbar和navigationbar的若干问题
  8. iOS设备的硬件适配 (关于armv6, armv7, armv7s ) <转>
  9. 由于权限不足而无法读取配置文件出现的HTTP 500.19解决办法
  10. 使用cl编译C/C++
  11. Redux源码分析之bindActionCreators
  12. Python学习笔记(四)
  13. VisionPro随笔-Visionpro空间字符的含义
  14. ●POJ 1509 Glass Beads
  15. iOS平台添加Google Admob -2/2(Unity3D开发之八)
  16. [转] JavaScript中in操作符(for..in)、Object.keys()和Object.getOwnPropertyNames()的区别
  17. mysqldump 导出
  18. 平均数_中位数_众数在SqlServer实现
  19. uva 12222 Mountain Road
  20. CentOS 源码编译安装 Python3

热门文章

  1. Python 3.9 新特性速览
  2. java 反射之静态and动态代理
  3. 实验五  用PS制作图文合成海报
  4. 多测师讲解pyhon__hashlib_高级讲师肖sir
  5. 落地Azure CosmosDb的一个项目分享
  6. go 接口实现
  7. Gitlab 11.9.1 高可用教程
  8. Excel中外部数据链接无法删除的解决方法【转】
  9. 在windows2003上安装itunes
  10. BOOST 条件变量使用