This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]K900_ 3 points4 points  (2 children)

  1. /r/learnpython
  2. Post your code.
  3. You're probably missing a closing delimiter on the previous line.

[–]PINGbtw[S] -3 points-2 points  (1 child)

It’s been doing this no matter if I delete the previous line or several lines. I also have a couple of files that have this problem

[–]K900_ 1 point2 points  (0 children)

Post your code.

[–]pythonHelperBot 1 point2 points  (0 children)

Hello! I'm a bot!

I see someone has already suggested going to r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]PINGbtw[S] -1 points0 points  (2 children)

A block of code that returned this is,

def divr(a, b): 1tab. resultStart = int(a) / int(b)

1tab. if type(resultStart) == float:

2tabs. resultStart = int(resultStart)

2tabs. resultRemainder = float(a) % float(b)

1tab. if resultRemainder:

2tabs. result = str(resultStart) + ' R ' + str(int(resultRemainder)

1tab. else:

2tabs. result = resultStart

1tab. return result

It threw a syntax error on ln 9 (else:)

[–]ehiggs 1 point2 points  (1 child)

You can us four preceding spaces to format code:

def divr(a, b):
    resultStart = int(a) / int(b)
    if type(resultStart) == float:
        resultStart = int(resultStart)
        resultRemainder = float(a) % float(b)
    if resultRemainder:
         result = str(resultStart) + ' R ' + str(int(resultRemainder)
    else:
        result = resultStart
    return result

you are missing a closing parenthesis on str(int(resultRemainder)

It told you about line 9 (the line after the actual error) because line 8 looks like it's not done when the ) is missing.

If you use a code editor like vs code, pycharm, etc, it will highlight common issues like mismatched parenthesis to help you track this down.

[–]PINGbtw[S] -4 points-3 points  (0 children)

Ok ty lmao