Example #1
0
def main(argv):
    try:
        radius = randint(1,100)
        cir = Circle(radius)
        print('Circle Radius {0}, Diameter = {1}, Area = {2}, Circumference = {3}'.format(cir.radius, cir.diameter(), cir.area(), cir.circumference()))


        a = Complex()
        b = Complex(2)
        c = Complex(1.0, 2.3)
        d = Complex(-2.0, 2.3)
        e = Complex(3.2, -2.3)

        print('sum --> {0}, {1} = {2}'.format(c, d, c + d))
        print('sum --> {0}, {1} = {2}'.format(c, 3, c + 3))
        print('sum --> {0}, {1} = {2}'.format(3, c, 3 + c))

        print('sub --> {0}, {1} = {2}'.format(c, d, c - d))
        print('sub --> {0}, {1} = {2}'.format(c, 3, c - 3))
        print('sub --> {0}, {1} = {2}'.format(3, c, 3 - c))

        print('mult --> {0}, {1} = {2}'.format(c, d, c * d))
        print('mult --> {0}, {1} = {2}'.format(c, 3, c * 3))
        print('mult --> {0}, {1} = {2}'.format(3, c, 3 * c))


        print('div --> {0}, {1} = {2}'.format(c, d, c / d))
        print('div --> {0}, {1} = {2}'.format(c, 3, c / 3))
        print('div --> {0}, {1} = {2}'.format(3, c, 3 / c))
        print('div --> {0}, {1} = {2}'.format(3, complex(1.0, 2.3), 3 / complex(1.0, 2.3)))

        print('conjugate --> {0}'.format(c))

        print('Root '.format())


    except Exception as ex:
        print(ex)
Example #2
0
    if number == 1:
        p_list.append(odpoved1.text)
    elif number == 2:
        p_list.append(odpoved2.text)
    elif number == 3:
        p_list.append(odpoved3.text)
    elif number == 4:
        p_list.append(odpoved4.text)


pygame.init()
clock = pygame.time.Clock()

circles_num = []
for idx, circle in enumerate(circles_json['circles']):
    circles.append(Circle(circle['x'], circle['y']))
    circles[idx].colour = okruhy_barva[okruhy[idx]]
    if idx > 0:
        circles_num.append(Text('arial', 15, f'{idx}', 'black'))
    else:
        circles_num.append(Text('arial', 15, 'START', 'black'))

question = Text('arial', 40, 'a', 'black')
odpoved1 = Text('arial', 20, 'a', 'black')
odpoved2 = Text('arial', 20, 'a', 'black')
odpoved3 = Text('arial', 20, 'a', 'black')
odpoved4 = Text('arial', 20, 'a', 'black')
odpovedi = pygame.sprite.Group(odpoved1, odpoved2, odpoved3, odpoved4)
question.rect.y = 200
question.rect.x = 100
odpoved1.rect.y = 365
Example #3
0
def main():
    _circle = Circle()
    _radii = np.arange(0, 10.5, 0.5)

    for r in _radii:
       print('{0} --> {1}'.format(r, _circle.circle_area(r)))
Example #4
0
p1_cups = []
p2_cups = []

# CREATING CUPS
c_startx = table_cornerx + sizex * 0.15
c_starty = table_cornery + sizey * 0.1
c_size = sizex * 0.07 * 6/n

r_rocks = c_size/9

arrows = []

for i in range(2):
    arrows.append(create_arrow(canvas, 20, c_starty, c_size, '#CC5801'))
    for j in range(n):
        c = Circle(c_startx, c_starty, c_startx + c_size,
                   c_starty + c_size, r_rocks, k, canvas)
        c_startx += sizex * 0.0875 * 6 / n
        cups.append(c)

    c_startx = c_startx - (sizex * 0.0875 * 6)
    c_starty = sizey - c_starty - c_size


home_cirx = sizex * 0.13
home_ciry = tabley * 0.2
home_bound = sizex * 0.02

# CREATING HOME CUP

x0 = table_cornerx+home_bound
y0 = table_cornery+home_ciry