python代码求助
题目是:Write a program that:1- Takes a full sentence from the user.
2- Remove all punctuations from the text.
3- Then, check if the modified sentence is under 15 characters or not? If yes, turn the text into a snake style text*. If it is more than 15 characters, turn it into a pascal style text**.
*这里的snack style指的是replacing each space with an underscore (_)
**这里的pascal style指的是capitalizing all words (even the first word) and removing the space
我写的代码是:
i = input("what do you want to talk about?")
a = input.del(",",".",";")
b = len(a)
if b <= 15:
c = b.replace("","_")
elif b > 15:
c = b.upper(b)
我的问题是:
1)这个题目要求从用户那边拿整句句子,是这样写input吗?
2)它说要移除所有的标点,这个应该怎样写?
3)我的代码应该怎样改
最后感谢!
这个鸟语有一大半不懂,所以,通篇不懂 wp231957 发表于 2020-10-5 13:11
这个鸟语有一大半不懂,所以,通篇不懂
{:10_266:}
页:
[1]