SyntaxError: invalid syntax error.......

Asked 2 years ago, Updated 2 years ago, 19 views

print ('Equation 1 when the first and last terms are given')
print('When you know the first term and tolerance, press 2.')

Q = int(input('tell me')))
print('Q:', Q)

if Q == 1:
    F = int (input('Please enter the first term'))
    print('F:', F)
    Please enter S = int(input()'end term.'))
    print('S:', S)
    N = int(input() up to what number of terms are you going to add?')
    print('N:', N)

    Sn = (N * (F + S)) / 2
    print('The sum up to the term {} is {}.format(N, Sn))

if Q == 2:
    F = int (input('Please enter the first term'))
    print('F:', F)
    S = int(input()' Enter tolerance.'))
    print('S:', S)
    N = int(input() up to what number of terms are you going to add?')
    print('N:', N)

    Sn = (N * (2 * F + (N - 1) * S)) / 2
    print('The sum up to the term {} is {}.format(N, Sn))

else:
    print('Something's wrong.')
    print('Try it again.')

I made it like this, but there's an error... ** N = int(input() up to what number of terms are you going to add?') print('N:', N) ** There is an error in that part, but why is there an error...

python

2022-09-22 19:26

1 Answers

You have less parentheses closed

 N = int('input(') up to what term?'))

I think we need to change it like this.


2022-09-22 19:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.