Reputation: 67
s = input(' Enter a monomial: ')
coeff, power = s.partition('x^')
print('{}x^{}'.format(int(coeff) * int(power), int(power) - 1)
I do not know what else is needed at the end of this code. Is there something that needs to be added in?
Upvotes: 1
Views: 503
Reputation: 21
You missed a bracket in last line:
print('{}x^{}'.format(int(coeff) * int(power), int(power) - 1))
Upvotes: 1
Reputation: 875
It's because you're not closing print
function, one a close parenthesis at the end is missing. I suggest you to use some linter
to debug and find warning and errors. The final code should be as below:
s = input(' Enter a monomial: ')
coeff, power = s.partition('x^')
print('{}x^{}'.format(int(coeff) * int(power), int(power) - 1))
Upvotes: 2