Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a, b, c, d = map(int, input().split())
- one = -(a + b + c + d)
- two = a*b + a*c + a*d + b*c + b*d + c*d
- three = -(a*b*c + a*b*d + a*c*d + b*c*d)
- four = a*b*c*d
- def f(x):
- if x > 0:
- if x == 1:
- res = ' + '
- else:
- res = f' + {x}'
- elif x < 0:
- if x == -1:
- res = ' - '
- else:
- res = f' - {abs(x)}'
- else:
- res = ''
- return res
- x3 = x2 = x = zero = ''
- if f(one) != '':
- x3 = f'{f(one)}x^3'
- if f(two) != '':
- x2 = f'{f(two)}x^2'
- if f(three) != '':
- x = f'{f(three)}x'
- if f(four) != '':
- zero = f'{f(four)}'
- if zero == ' + ':
- zero = ' + 1'
- elif zero == ' - ':
- zero = ' - 1'
- print('x^4', x3, x2, x, zero, sep='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement