Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 4, Problem 8PE
Program Plan Intro

Program to draw a line segment

Program plan:

  • Import the math package.
  • Import the required graphics package.
  • Define the main method.
    • Using the object GraphWin(), to display the graphics window.
    • Using the method setCoords(), set the size of the graphics window.
    • Prompt the user for 2 mouse clicks.
    • Store coordinates in variables x1, x2, y1 and y2.
    • Using the method Line(), draw a line with midpoint in cyan color.
    • Compute the length and slope of the line using the formula given in textbook.
    • Print the length and slope of line.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
Draw a rectangular where number of rows (10) and number of columns (20) by using For-Next loop visual basic
Python Turtle Graphics Draw a spiral diagram using Python turtle package program follows 3 steps: Import the turtle module Create a turtle to control. Draw around using the turtle methods. You should consider the following points in your solution: The shapes should be drawn with the shown colors Yellow and white for the square-like shapes. Blue for the background. The prompt should have a turtle shape. The number of iterations should be 300 You should use only one loop. The number of the yellow color lines should be 200. The final shape of the output should be as shown in the picture attached. Make sure to set properly the starting position (x & y) of your drawing, to maintain the required diagram. video on youtube: https://www.youtube.com/watch?v=ZqoJD2RMu1I
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3,5,6 and 9. The sum of this multiples is 23. find the sum of all the multiples of 3 or 5 below 1000.  in Visual Basic
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Expressions in C++ | C++ tutorial for beginners; Author: Tutorial Mart;https://www.youtube.com/watch?v=XHbsZGpmRc8;License: Standard YouTube License, CC-BY
expression in python # python expressions; Author: Abhishek Tripathi;https://www.youtube.com/watch?v=Cc-kJGRjH6k;License: Standard Youtube License