GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python/volume_cube.py at master · kudou/Python

Expand file tree

/

volume_cube.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
34 lines (23 loc) · 741 Bytes
/

volume_cube.py

Copy path

File metadata and controls

34 lines (23 loc) · 741 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# This program is used to excerise debug
import random
def volume_cube(side):
return side ** 3
s = 2
print "Volume of cube with side", s, "is", volume_cube(s), "."
def random_dice():
die1 = random.randint(1, 6)
die2 = random.randint(2, 8)
print die1, die2
return die1 + die2
print "Sum of two random dice, rolled once:", random_dice()
print "Sum of two randon dice, rolled again:", random_dice()
import math
def volume_sphere(radius):
return float(4) / 3 * math.pi * (radius ** 3)
r = 2
print "Volume of sphere of radius", r, "is", volume_sphere(r), "."
def area_triangle(base, height):
return float(1) / 2 * base * height
b = 5
h = 4
print "Area of triangle with base", b, "and height", h, "is", area_triangle(b, h), "."
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.