佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 364|回复: 3

python

[复制链接]
发表于 26-1-2019 01:10 PM | 显示全部楼层 |阅读模式
本帖最后由 gnow10 于 26-1-2019 01:15 PM 编辑

请求各位python大神!

我是python新手,做了很多天做不出来,需要高手帮忙解决。

https://www.dropbox.com/s/6fwbaf ... u%20system.pdf?dl=0

请高手帮帮忙,谢谢
回复

使用道具 举报


ADVERTISEMENT

发表于 12-2-2019 04:06 PM | 显示全部楼层
有哪部分做不到?
回复

使用道具 举报

 楼主| 发表于 13-2-2019 03:02 PM | 显示全部楼层

已经解决了
回复

使用道具 举报

 楼主| 发表于 16-6-2019 04:26 PM | 显示全部楼层
Question:        During the printing of the movie details, all parts of the code that prints the movie details shall be replaced by the PrintMovieDetails() function created without any changes to the existing format of displaying the movie details.

For example:
Name: The Avengers
Category: Fantasy
Description: Earth's mightiest heroes must come together and learn to fight
as a team if they are going to stop the mischievous Loki and his alien army from enslaving humanity..
Price: $16.5



青色部分是要用PrintMovieDetails(movie)的function来显示的,要怎么更改现有的code来call这个新function?

def PrintMovieDetails(movie):   
    print("Name: "+movie.getName())
    print("Category: "+movie.getCategory())
    print("Description: "+movie.getDescription())
    print("Price: $"+str(movie.getPrice()))
   
def menu1():   
    print("\n\nDisplay all movies")
    index = 0
    usrInput = ""
    while usrInput != "M":
        try:      
            print("\nMovie "+str(index+1)+" of "+str(len(listOfMovies)))
            print("==============================")
            #use new function to display the movie details
            print("Name: "+listOfMovies[index].getName())
            print("Category: "+listOfMovies[index].getCategory())
            print("Description: "+listOfMovies[index].getDescription())
            print("Price: $"+str(listOfMovies[index].getPrice()))        
            print("==============================")
            print("Enter N for Next movie")
            print("Enter P for Previous movie")
            usrInput = input("Enter M to return to Main Menu\n")        
           
            if usrInput == "N":
                index += 1
            if index >= len(listOfMovies):
                index = 0
            elif usrInput == "P":
                index -= 1
            if index < 0:
                index = len(listOfMovies)-1

        except Exception as e:
            print("IndexError occurred")



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 24-4-2024 05:25 AM , Processed in 0.053120 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表