Skip to content

Instantly share code, notes, and snippets.

# Decimals are also the type in python. Without using 'decimals' library, floats would
# only give you the 'precise' or closest value but not the acurate one.
# Try not to use money and scientific related problems with normal float type
# instead use 'decimal' library for calculations, you want acuracy.
# Floating point
print(1 / 3)
print(1 / 2 + 2 / 3)
# Decimals fixed prescion
import fresh_tomatoes
import media
toy_story = media.Movie("Toy story", "A story of a boy whose toys come to life",
"https://en.wikipedia.org/wiki/Toy_Story#/media/File:Toy_Story.jpg",
"https://www.youtube.com/watch?v=KYz2wyBy3kc")
#print (toy_story.storyline)
avatar = media.Movie('Avatar', 'A marine on an alien planet',
"https://upload.wikimedia.org/wikipedia/en/b/b0/Avatar-Teaser-Poster.jpg",
for a in range(1, 21):
if a % 3 == 0:
print('fizz')
if a % 5 == 0:
print('buzz')
if a % 3 != 0 and a % 5 != 0:
print('fizzbuzz')
import webbrowser
import os
import re
# Styles and scripting for the page
main_page_head = '''
<head>
<meta charset="utf-8">
<title>Fresh Tomatoes!</title>
import webbrowser
class Movie():
"""this classs provides a way to store movies related infornation"""
VALID_RATINGS = ['G', 'PG', 'PG1-3', 'R']
def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube):
self.title = movie_title