Skip to main content
 首页 » 编程设计

python之如何获得每行打印一个单词的列表

2025年05月04日17zhujiabin

<分区>

如何获取每行打印一个单词的列表?

Write a program that takes a list of student names and sorts them to create a class roll. The list of names will be given on a one line separated by a single space.

The program should work like this:

Students: Peng Ivan Alan Jodi Macy 
Class Roll 
Alan 
Ivan 
Jodi 
Macy 
Peng 

相反,我的程序是这样工作的:

Students: Peng Ivan Alan Jodi Macy 
Class Roll ['Alan', 'Ivan', 'Jodi', 'Macy', 'Peng'] 

我的程序是这样的:

如何在单行上打印?