我需要一个程序,询问用户 3 个字母,然后询问用户一个字符串,然后打印出字符串中以三个字母开头的所有单词......例如
Enter 3 letters: AMD
Enter text: Advanced Micro Devices is a brand for all microsoft desktops
word: Advanced Micro Devices
word: all microsoft desktops
这很简单。我是新手,无法弄清楚如何......我的代码目前......
ipt1 = raw_input("Three letters: ") ## Asks for three letters
ipt2 = raw_input("Text: ") ## Asks for text
ipt1_split = ipt1.split() ## Converts three letters to list
ipt2_split = ipt2.split() ## Converts text to list
我不确定你是否需要一份清单,有人知道如何解决这个问题吗?谢谢!