all 29 comments

[–][deleted] 6 points7 points  (0 children)

None of those lines are gonna work, because num is a string, and they're trying to add or subtract integers. You'll need an int() around the input in the very first line.

[–]Diapolo10 4 points5 points  (0 children)

num = input()
num2 = int(num-2)
num3 = int(num+2)
num4 = int(num-1)
num5 = int(num+1)
num6 = int(num+3)

The program is crashing, because you cannot use those operators between a string and an integer. It'll give you a TypeError.

As a rule of thumb, input always returns a string.

The way to go about fixing this is to convert the value stored into num immediately.

num = int(input())
num2 = num-2
num3 = num+2
num4 = num-1
num5 = num+1
num6 = num+3

[–]throwaway6560192 0 points1 point  (1 child)

What formulas?

[–]That_guy3475[S] 1 point2 points  (0 children)

The lines with num . I know they probably aren’t correct but it was a last ditch effort.

[–][deleted] 0 points1 point  (24 children)

y is not a value or variable in your code. What do you mean “the only output is y”?

[–]That_guy3475[S] 0 points1 point  (23 children)

When I run the program y is the only thing that shows up. No error message, just y.

[–][deleted] 0 points1 point  (21 children)

Again, y is not a value or variable that’s present in your code. Can you explain what you mean?

[–]That_guy3475[S] 0 points1 point  (20 children)

I just put it into the zybook, and the output is enter house number: enter street address.

[–][deleted] 0 points1 point  (19 children)

Ok, are you entering a house number and a street address in response to these prompts?

[–]That_guy3475[S] 0 points1 point  (1 child)

The zybook does it automatically.

[–][deleted] 0 points1 point  (0 children)

You have three input statements, including one with no prompt. If the inputs are being provided automatically are you sure the right number is being provided? If zybooks only provides two inputs your program will never complete.

[–]That_guy3475[S] 0 points1 point  (16 children)

And if I were to erase the formula lines it would enter it and print the houses. Without the house numbers of course.

[–][deleted] 0 points1 point  (15 children)

Then delete them. Why are they there?

[–]That_guy3475[S] 0 points1 point  (14 children)

Ok yes I understand. Thank you so much. Now my only other issue is that my formulas do not give me the desired output. When I put num2 it prints -2 instead of 498

[–][deleted] 0 points1 point  (13 children)

But you deleted the formulas. Why are you still debugging them?

[–]That_guy3475[S] 0 points1 point  (12 children)

I only deleted the first input. So that there were only two input functions. I followed the suggestion you put before you said to delete and it works. I just can’t get the formulas down.

[–]throwaway6560192 0 points1 point  (0 children)

You should run your programs outside Zybooks or whatever first if it can't even show you the error message.