A
A
alex_6432020-06-11 13:12:56
Python
alex_643, 2020-06-11 13:12:56

How to break a number into terms?

Good day! I need to write an algorithm for splitting a number into 2 terms. I searched on the Internet in python, I did not find an implementation. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2020-06-11
@LazyTalent

>>> import random
>>> def foo(number):
...     first = random.randint(0, number)
...     second = number - first
...     return first, second
... 
>>> foo(123)
(39, 84)

R
Rsa97, 2020-06-11
@Rsa97

слагаемое1 = 1
слагаемое2 = число - 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question