1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Artemon [7]
3 years ago
15

a) Before writing any code, you should go through a design process. Try to do so carefully – either follow a top-down approach,

a full bottom-up approach, or some combination. But, in any case, you should come up with a list of functions you plan to implement, each with its own clear purpose. a. Create a document that outlines all the functions you will create, including a purpose for each, stating what the function does, and any parameters it has. The purpose for each function can become its docstring b) After you have written a description of your program, including the planned functions, go ahead and write code for each function. Be sure to create a docstring for each function. Turn in your program and the design document you created beforehand. Challenge: See if you can create a program so that the lines are drawn
Computers and Technology
1 answer:
olga55 [171]3 years ago
3 0

Answer:

See Explaination

Explanation:

import turtle

def drawLine(x,y,height):

'''

method to draw a vertical line from x,y with given height

'''

turtle.up()

turtle.goto(x,y)

turtle.down()

turtle.goto(x,y-height)

def drawSet(x,y,height):

'''

method to draw a full set of tally marks

'''

temp = x

#drawing 5 vertical lines

for j in range(4):

drawLine(temp,y,height)

temp+=20

#drawing a line crossing all previous lines

turtle.up()

turtle.goto(x-5,y-height/2)

turtle.down()

turtle.goto(temp-15,y-height/4)

def drawPartialSet(x,y,height,count):

'''

method to draw an incomplete set (less than 5 tally marks)

'''

temp = x

for j in range(count):

drawLine(temp,y,height)

temp+=20

#getting number

num=int(input('Enter the number: '))

#finding number of complete sets

sets=num//5

#finding number of incomplete sets

extra=num%5

#setting up turtle

turtle.setup(width=500,height=500)

turtle.pensize(5)

turtle.speed(0) #max speed

#starting x, y coordinates

x=-240

y=250

line_height=80 #height of one tally line

#drawing all complete sets

for i in range(1,sets+1):

drawSet(x,y,line_height)

x+=line_height

if i%5==0:

#moving to next line after every 5 sets

x=-240

y-=line_height+50

#drawing extra sets if exist

if extra>0:

drawPartialSet(x,y,line_height,extra)

turtle.ht() #hide turtle

turtle.done() #finish drawing

You might be interested in
What is the Purpose and function of the Global Positioning System (GPS)?
murzikaleks [220]
The global positioning system (GPS) is a space-based radio-positioning and time-transfer system. GPS satellites transmit signals to proper equipment on the ground. These signals provide accurate position, velocity, and time (PVT) information to an unlimited number of users on ground, sea, air, and space.
8 0
3 years ago
The refresh or reload button is in the browser toolbar and usually looks like a pair of curved arrows. Clicking it will ________
docker41 [41]

Your answer would be

D. Restart the downloading process

5 0
3 years ago
Read 2 more answers
Given the following code, what is output by the method call, mystery(6 * 8)? public static void mystery (int x[]) { System.out.p
____ [38]

Answer:

B

Explanation:

This question demonstrates the concept of method overloading

Method overloading means having different versions of the same method. In this case the method mystery() has three versions. The compiler is able to determine which method to call by their different parameters

The first implementation of mystery requires an array of integers as parameter

The second implementation requires an int variable

The third implementation requires a String

The Method call mystery(6 * 8) will output B because 6*8 evaluates to an integer which is the expected argument.

7 0
3 years ago
The set of rules for how computers talk to one another
andrezito [222]
That is program ............
4 0
3 years ago
Write a paragraph expressing how you'd use the computer to enhance your place of work.​
Charra [1.4K]

Answer:

Have water by, have it organized, and have notes by you welcome.

Explanation:

4 0
3 years ago
Other questions:
  • What must be done if the intended destination hardware is not supported by the chosen OS?
    6·1 answer
  • Which of these statements is true? Steve Jobs invented the mouse as an input device. Bill Gates invented the mouse as an input d
    6·1 answer
  • A motherboard has four DIMM slots; three slots are gray and the fourth is black. What type of memory is this board designed to u
    6·1 answer
  • A key field is used to _____. enter a password uniquely identify records merge data list the most important information
    12·2 answers
  • 1. Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address
    7·1 answer
  • Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in byt
    5·1 answer
  • A rectangle indicates a single process.true or false​
    7·2 answers
  • Rosanna is a middle school teacher. She has installed a spreadsheet program in her computer that tracks the grades and attendanc
    10·1 answer
  • Consider our authentication protocol 4.0, in which Alice authenticates herself to Bob, which we saw works well (i.e., we found n
    15·1 answer
  • Which of the following offers more reliable antivirus protection? Question 43 options: A) antivirus software on user PCs B) anti
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!