Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> num1=5 >>> num2=7 >>> product = num1 * num2 >>> print (product) 35 >>> #+, -, *, / >>> quotient = 23 / 3 >>> print (quotient) 7.666666666666667 >>> quotient = 23 // 3 >>> print (quotient) 7 >>> remainder=23 % 3 >>> print (remainder) 2 >>> number = eval(input("Enter a number ")) Enter a number 5 >>> square = number * number >>> print (square) 25 >>> number = float(input("Enter a number ")) Enter a number 5 >>> print number SyntaxError: Missing parentheses in call to 'print' >>> print (number) 5.0 >>> number = int(input("Enter a number " )) Enter a number 5 >>> print(number) 5 >>>
#This program will show #Some of the graphics features #of the graphics libray #Steve 10/5/2017 #import graphics from graphics import * def main(): win=GraphWin ("Drawings",width=500, height=500) p=Point(50,60) p.draw(win) p3=Point(160,90) p3.draw(win) line=Line(p,p3) line.draw(win) center=Point(100,100) circ = Circle(center, 30) circ.setFill("blue") circ.draw(win) p4=Point(20,50) p5=Point(80,150) oval=Oval(p4,p5) oval.draw(win) main()
No comments:
Post a Comment