CodeHS #3.3.4 Horizontal line

Joined
Feb 12, 2025
Messages
2
Reaction score
0
def horizontal_line(y, length):
print(f"Line at y = {y}: " + "-" * length)

# Example usage
horizontal_line(100, 20)
horizontal_line(200, 10)
horizontal_line(300, 5)

## I had to finish at home, however the date/time didn't sync until I opened it.
## The paste text in the revision history, I did this only in the sandbox
## I ONLY USED CHATGPT TO HELP ME DISSECT IT, I DID NOT USE IT TO DO THE TASK.
## The workaround was to use another canvas, if I did use the existing one it
## would have either stopped or broken the code.
## I experimented with this dozens and dozens of times, so any recent ones were
## the ones that might've worked, and I had ChatGPT help me narrow the
## possibilities down and this was the only code that would work best.
## Again, I do not use chatgpt for assignment, i use it to help me dissect.

## As of 2025-02-12 09:18, I have decided to rewrite the code.
## I don't understand the problem, I have worked countless times in the past 48
## hours to determine the problem. The goals are to get a line, and autograder
## to work and actually submit said assignment.

## This may be the only assignment where I'll just have to abandon it as is
## because I have no further knowledge to continue fixing and working the code.

## I begun working further when I went home on 2/10 and begun working.
## It has been over 48 hours since I've worked, with countless problems.
## At this point, I'ma just call it a day with the current code.

## No line appears, and it's even led to me asking ChatGPT and using the code
## which does nothing, so I ended that topic with them and I think I went onto
## some forum online to figure out why this is happening.

## I've "instructed" the code to print 3 horizontal lines ON THE CANVAS, not the
## console log. It had 1 job, and it failed.

## There is no other solution I can try at this point, I've tried everything for
## literally over 2 days at this point. I'm leaving it as is unless someone can
## fix the code.
 
Joined
Feb 12, 2025
Messages
1
Reaction score
0
I don't really know what this assignment is but what if you used the Line() method?

line = Line(0, y, length, y)
add(line)

if you put this in the horizontal_line function, it might help solve your problem.
 
Joined
Dec 10, 2022
Messages
111
Reaction score
26
I don't really know what this assignment is but what if you used the Line() method?

line = Line(0, y, length, y)
add(line)

if you put this in the horizontal_line function, it might help solve your problem.

What is the Line method? What module is it imported from?. The function takes two arguments, y and length and prints it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,239
Messages
2,571,199
Members
47,833
Latest member
JessieKwon

Latest Threads

Top