import webbrowser class Movie(): def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube): self.title = movie_title self.story_line = movie_storyline self.poster_image = poster_image self.trailer_youtube_url = trailer_youtube def show_trailer(self): webbrowser.open(self.trailer_youtube_url) import media toy_story = media.Movie("Toy Story", "A story of a boy and his toys that come to life", "https://upload.wikimedia.org/wikipedia/en/thumb/1/13/Toy_Story.jpg/220px-Toy_Story.jpg", "www.youtube.com/watch?v=KYz2wyBy3kc") ##print(toy_story.storyline) avatar = media.Movie("Avatar", "A marine that hugs trees", "https://en.wikipedia.org/wiki/File:Avatar-Teaser-Poster.jpg", "www.youtube.com/watch?v=5PSNL1qE6VY") print(avatar.storyline) avatar.show_trailer()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question