python3学习每日一题
前言
今天的题目是遇到的最简单的一个直接使用字典
题目
In this Clash you have to recreate the emoji system of CodinGame.
For example, if you type this in the chat you get:
:slight_smile: --> 😃
😞 --> 😦
Input
An string s
Output
The string, with emojis inserted:
:slight_smile: —> 😃
😞 —> 😦
:loud_laugh: —> XD [not a real chat emoji conversion]
😮 —> 😮
😛 —> :p
THESE WILL BE THE ONLY EMOJIS COMING IN THE TEST CASES
Constraints
Length of s <= 100
Each word is seprated by a single whitespace
Example
Input
This is SOO easy :loud_laugh:
Output
This is SOO easy XD
直接上代码nobb(虽然还是菜)
代码如下:
import sys
import math
enjoy={"slight_smile":":)","disappointed":":(","loud_laugh":"XD","open_mouth":"o","stuck_out_tongue":"p"}
s=input()
s=s[:100]
print(enjoy[s])
总结
就能做简单的了菜菜死算了