def test_deck(): cards = [ Card.Card(suit, face) for face in card_faces for suit in card_suits ] stack = cards[-28:] stock = cards[:24] pyramid = Pyramid.Pyramid(stack) return State.State(stack, stock, pyramid, [])
def new_deck(): """ Setup a new random deck :return type: State """ cards = [ Card.Card(suit, face) for face in card_faces for suit in card_suits ] shuffle(cards) stack = cards[:28] stock = cards[-24:] pyramid = Pyramid.Pyramid(stack) return State.State(stack, stock, pyramid, [])
def test_height_is_int(): assert Pyramid.check_height("f") == -1
import Pyramid, Sphere, Box m1 = input( "If you would like to test for a rectangular prism, enter B. If you would like to test for a rectangular pyramid, enter P. If you would like to test for an ellipsoid, enter S." ) #m1 = upper(m1) l = float(input("Enter the length of your object:")) w = float(input("Enter the width of your object:")) h = float(input("Enter the height of your object:")) if m1 == "B": myShape = Box.Box(l, w, h) elif m1 == "P": myShape = Pyramid.Pyramid(l, w, h) elif m1 == "S": myShape = Sphere.Sphere(l, w, h) else: print("Invalid mode.") print("Volume: ", str(myShape.getVolume())) print("Surface area: ", str(myShape.getSurfaceArea()))
import Box import Sphere import Pyramid myShape = input("Select the shape to calculate: Box = b, Sphere = s, Pyramid = p - ") if myShape = 'b': l = int(input("Print your Length of the box -")) w = int(input("Print your Width of the box -")) h = int(input("Print your Height of the box - ")) b = Box.Box(l,w,h) print(b.calcvolume()) print(b.calcsurface()) elif myShape == 's': r = int(input("Print your Radius of sphere -")) s = Sphere.Sphere(r) print(s.calcvolume()) print(s.calcsurface()) elif myShape == 'p': b = int(input("Print your Base of the pyramid -")) h = int(input("Print your Height of the pyramid -")) s = int(input("Print your slant of the pyramid-")) p = Pyramid.Pyramid(b,h,s) print(p.calcvolume()) print(p.calcsurface())
#Box if selection == 'box': length = int(input("What is the length of your box: ")) width = int(input("What is the width of your box: ")) height = int(input("What is the height of your box: ")) box = Box.Box(length, width, height) box.volume() box.surArea() #Pyramid elif selection == 'pyramid': length = int(input("What is the length of your pyramid: ")) width = int(input("What is the width of your pyramid: ")) height = int(input("What is the height of your pyramid: ")) pyramid = Pyramid.Pyramid(length, width, height) pyramid.volume() pyramid.surArea() #Sphere elif selection == 'sphere': length = int(input("What is the length of your sphere: ")) width = int(input("What is the width of your sphere: ")) height = int(input("What is the height of your sphere: ")) sphere = Sphere.Sphere(length, width, height) sphere.volume() sphere.surArea() #They Goofed else: print("Oops something went wrong, try again")
#!/usr/bin/python3 import Box, Pyramid, Sphere shape = input("Enter a shape (Box, Pyramid, Sphere): ") if (shape == "Box" or shape == "B" or shape == "box" or shape == "b"): b1 = Box.Cube() b1.bw = int(input("Box width: ")) b1.bl = int(input("Box length: ")) b1.bh = int(input("Box height: ")) b1.volume() b1.surfaceArea() elif (shape == "Pyramid" or shape == "P" or shape == "pyramid" or shape == "p"): p1 = Pyramid.Cypher() p1.pw = int(input("Pyramid width: ")) p1.pl = int(input("Pyramid length: ")) p1.ph = int(input("Pyramid height: ")) p1.volume() p1.surfaceArea() elif (shape == "Sphere" or shape == "S" or shape == "sphere" or shape == "s"): s1 = Sphere.Orb() s1.r = int(input("Radius: ")) s1.volume() s1.surfaceArea()
def test_height_equal_to_zero(): assert Pyramid.check_height("0") == -1
def test_pyramid_line_1_height_5(): assert Pyramid.build_line(1, 5) == " ##"
def test_height_is_valid(): assert Pyramid.check_height("5") == 5
def test_height_is_greater_than_23(): assert Pyramid.check_height("24") == -1
import Box import Pyramid import Sphere shape = input( "What kind of shape do you want? Answer B for box, S for sphere, P for pyramid: " ) if (shape == "B"): box1 = Box.Cube() box1.w = int(input("Box width: ")) box1.l = int(input("Box length: ")) box1.h = int(input("Box height: ")) box1.volume() box1.SA() elif (shape == "S"): sphere1 = Sphere.Pokeball() sphere1.r = int(input("Sphere radius: ")) sphere1.volume() sphere1.SA() elif (shape == "P"): pyramid1 = Pyramid.FidgetSpinner() pyramid1.pW = int(input("Pyramid width: ")) pyramid1.pL = int(input("Pyramid length: ")) pyramid1.pH = int(input("Pyramid height: ")) pyramid1.volume() pyramid1.SA()
background = pygame.Surface((800,600)) points=0 timeleft=60 maxcoins=5 ctime=0 defeat=False victory=False grass = Ground() grass.draw(background) money=Coins() changedrecs = [] guy = Person(50,50) guy.cinterval=5000 guy.cs=0 guy.maxcs=5 pyramid=Pyramid(650,30) pbase=Base(650,88) #oldman= OldMan(random.randint(0,783),random.randint(0,577)) oldman = OldMan(100,200) clerk = Clerk(200,100) collector= Collector(200,200) runner= Runner(400,400) font = pygame.font.Font(None, 36) text = font.render("Money: "+str(guy.cs), 1, (10, 10, 10)) peoplelist=[oldman,clerk,collector,runner] blist=[pbase] while True: grass.draw(background) screen.blit(background,(0,0)) guy.draw(screen) runner.move()
def test_pyramid_line_7_height_7(): assert Pyramid.build_line(7, 7) == "########"
def test_height_less_than_zero(): assert Pyramid.check_height("-5") == -1
import Box import Pyramid import Sphere shape = input( "Choose which shape you want to calculate: Box, Sphere, or Pyramid ") if shape == 'Box': l = int(input("Type the Length of your Box ")) w = int(input("Type the Width of your Box ")) h = int(input("Type the Height of your Box ")) b = Box.Box(l, w, h) print('This is the Surface Area of your Box | ', b.getSurfaceArea()) print('This is the Volume of your Box | ', b.getVolume()) elif shape == 'Pyramid': l = int(input("Type the Length of your Pyramid ")) w = int(input("Type the Width of your Pyramid ")) h = int(input("Type the Height of your Pyramid ")) p = Pyramid.Pyramid(l, w, h) print('This is the Surface Area of your Pyramid | ', p.getSurfaceArea()) print('This is the Volume of your Pyramid | ', p.getVolume()) elif shape == 'Sphere': r = int(input("Type the Radius of your Sphere ")) s = Sphere.Sphere(r) print('This is the Surface Area of your Sphere | ', s.getSurfaceArea()) print('This is the Volume of your Sphere | ', s.getVolume())
import Box import Pyramid import Sphere shape = input("Enter which shape you would like to calculate (b = box, s = sphere, or p = pyramid) : ") if shape == "b": b1 = Box.Box() b1.length = int(input("Enter box length: ")) b1.width = int(input("Enter box width: ")) b1.length = int(input("Enter box length: ")) b1.volume() b1.surfArea() elif shape == "p": p1 = Pyramid.Pyramid() p1.length = int(input("Enter pyramid length: ")) p1.width = int(input("Enter pyramid width: ")) p1.height = int(input("Enter pyramid height: ")) p1.volume() elif shape == "s": s1 = Sphere.Sphere() s1.radius = int(input("Enter sphere radius: ")) s1.volume()