+ 5

Python program to separate a number containing 4 into two numbers without 4.Description provided below.answer fast.thanks!

For example, 44 is the number then it can be separated into 22 and 22 likewise the entered number should be separated into two numbers such that their sum is equal to input.

7th Apr 2019, 1:34 AM
LAKSHMINARAYANAN E
LAKSHMINARAYANAN E - avatar
3 Réponses
+ 6
According to my understanding, you want output numbers to not contain 4, so here it is just for the record. import random n = int(input()) while True: n1 = n - random.randint(1,n) n2 = n - n1 if '4' not in str(n1).join(str(n2)): break print(n1) print(n2) https://code.sololearn.com/c3z7982anzFE/?ref=app
7th Apr 2019, 2:56 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
Yes.. if NoIsEven : a = n/2 b= n/2 else : n = n + 1 a = n/2 b = n/2 -1 Any doubt please :)
7th Apr 2019, 2:07 AM
Ramshek Rana
Ramshek Rana - avatar
+ 2
Can you show your attempts?
7th Apr 2019, 2:07 AM
Hatsy Rei
Hatsy Rei - avatar