CS50python 作业LECUTR4

这篇博客涵盖了多个Python编程任务,包括将英文文本转换为emoji,使用pyfiglet库创建FIGlet字体效果,以正确方式告别多个名字,使用inflect库处理复数和序数形式,以及创建猜数字和数学问题解决游戏。任务涉及用户输入处理,随机数生成,错误检查和反馈机制。
摘要由CSDN通过智能技术生成

1、Because emoji aren’t quite as easy to type as text, at least on laptops and desktops, some programs support “codes,” whereby you can type, for instance, :thumbs_up:, which will be automatically converted to 👍. Some programs additionally support aliases, whereby you can more succinctly type, for instance, :thumbsup:, which will also be automatically converted to 👍

See carpedm20.github.io/emoji/all.html?enableList=enable_list_alias for a list of codes with aliases.

In a file called emojize.py, implement a program that prompts the user for a str in English and then outputs the “emojized” version of that str, converting any codes (or aliases) therein to their corresponding emoji.

import emoji

def main():
    words = input("Input: ")
    print(emoj(words))

def emoj(em):
    return emoji.emojize(em)

if __name__ == "__main__":
    main()

2、Among the fonts supported by FIGlet are those at figlet.org/examples.html.

FIGlet has since been ported to Python as a module called pyfiglet.

In a file called figlet.py, implement a program that:

  • Expects zero or two command-line arguments:
    • Zero if the user would like to output text in a random font.
    • Two if the user would
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值