Edit binary numbers. | SoloLearn: Learn to code for FREE!

+59

Edit binary numbers.

A matter. Input binary with spaces. For example: 1 0 1 0 1 0 and then edit the numbers individually. Suppose I want to give the value 1 a different value.

5/23/2020 4:43:19 PM

Aad Hoogenboom

13 Answers

New Answer

+6

Aad Hoogenboom Plz check it 👇👇👇 print(1-(sum([0.25 for i in (input()) if i=="1"])))

+50

Great job! You finished Module 4, Decision Tree Model, of our Machine Learning course! For additional practice, try this code coach challenge https://sololearn.com/coach/103

+45

Yes, nice. 👍👍

+45

It is code coach 103 machine learning. My code bits 52. Answer is oké. Test case #3,4,5. ???

+42

It concerns gini impurity. Input: 1 0 1 0 1 0. Suppose: 1 = 0.5. Suppose: 0 = 0. Gini = 1 - (0.5) ^ 2 + (0) ^ 2 + (0.5) ^ 2 etc. Gini = 1 - 0.75 Gini = 0.25

+4

+2

Aad Hoogenboom Code coach 103 , plz give its link

+2

Aad Hoogenboom could you please provide the coach text, since only pro users can see it

+1

Aad Hoogenboom Give an example of input & output

+1

Made this...although it does do what you original wanted...not sure if it's still relevant after seeing your last post:- # this changes "1 0 1 0 1 0" to "1 1 1 0 1 0" stringlist = list(''.join("1 0 1 0 1 0".replace(' ', ''))) stringlist[1] = "1" mystring = ' '.join(stringlist) print(mystring)

+1

Good question

0

👍👌👌