怎样用python写名字_如何用python写这个代码

展开全部

代码:"""

Problem 3: Populating the ratings tableThe function populateratings

( will read in a list of movie names, critic namesand ratings, and populate a two-dimensional array.

This is the same asroblem 5 in Assignment 4, except that the movie and critic names are inputthis time

instead of the index numbers for the movie and critic

问题3:填充评级表函数populate ratings

(将读取电影名称、评论家名称和评级列表,并填充一个二维数组)。32313133353236313431303231363533e58685e5aeb931333366306561

这是作业4中同样的问题5,只是这次输入的是电影和评论家的名字,

而不是电影和评论家的索引号。

"""

def populateratings():

result_list = []

while True:

input_list = []

movies_name = input("请输入电影家名字:\n")

input_list.append(movies_name)

critic_name = input("请输入评论家名字:\n")

input_list.append(critic_name)

ratings_name = input("请输入评级:\n")

input_list.append(ratings_name)

# 添加到二维数组

result_list.append(input_list)

is_done = input('继续输入吗?(Y:继续,N结束)\n')

if is_done.lower() == 'n':

break

return result_list

result = populateratings()

print(result)

输出请输入电影家名字:

singi

请输入评论家名字:

singn

请输入评级:

A

继续输入吗?(Y:继续,N结束)

y

请输入电影家名字:

lily

请输入评论家名字:

lilly

请输入评级:

B

继续输入吗?(Y:继续,N结束)

n

[['singi', 'singn', 'A'], ['lily', 'lilly', 'B']]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值