# graphics.py """Simple object oriented graphics library The library is designed to make it very easy for novice programmers to experiment with computer graphics in an object oriented fashion. It is written by John Zelle for use with the book "Python Programming: An Introduction to Computer Science" (Franklin, Beedle & Associates). LICENSE: This is open-source software released under the terms o... » Continue Reading
from graphics import* win = GraphWin('Face', 400, 400) #we'll need about 5 circles and one oval to make a mouth head = Circle(Point(200, 200), 100) head.setFill('purple') head.draw(win) le= Circle(Point(150, 200), 10) le.setFill('yellow') le.draw(win) re = Circle(Point(250,200), 10) re.setFill('yellow') re.draw(win) » Continue Reading
#This program creates a line of bubbles from graphics import * from time import sleep from random import randint W, H = 400, 400 r = 10 # randint(0, 8 ) #NOTES:: # how do we get two different coordinates # we have x1, y1 and x2,y2 # make a for loop subtracting the delta counts #x1 = x1 +dx/10 win = GraphWin('Bubbly', W, H, autoflush = False) #win.setCoords(0, 0 , 100, 100) » Continue Reading
print('This program calculates the average numbers entered by the user') N = int(input('How many numbers do you have?: ')) y = 0 for i in range(N): x = float(input('Please enter you number: ')) y = x + y print(f'The average of your numbers is {y/N:.1f}') ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('This progrsm calculates the average numbers entered by the user') N = int(input... » Continue Reading
import math a = float(input("please enter your a: ")) b = float(input("please enter your b: ")) c = float(input("please enter your c: ")) s = (a + b + c)/ 2 area = math.sqrt(s*(s-a) * (s -b) * (s-c)) print(area) » Continue Reading
import math a = float(input("please enter your a: ")) b = float(input("please enter your b: ")) c = float(input("please enter your c: ")) s = (a + b + c)/ 2 area = math.sqrt(s*(s-a) * (s -b) * (s-c)) print(area) » Continue Reading