我想创建一个程序,它从用户那里获取输入并提供如下的输出
Enter a string: Charlie
Enter a string: Delta
Enter a string: Alpha
Alpha
Charlie
Delta
答案 0 :(得分:0)
询问用户输入:
string1 = raw_input("Enter a string:")
string2 = raw_input("Enter a string:")
string3 = raw_input("Enter a string:")
然后打印出来:
print string3
print string2
print string1
按字母顺序排列
string1 = raw_input("Enter a string:")
string2 = raw_input("Enter a string:")
string3 = raw_input("Enter a string:")
array = [string1, string2, string3]
print sorted(array)