+ 32

[ ASSIGNMENT: ] Balanced Number

Balanced Number is the number that : The sum of all digits to the left of the middle digit(s) and the sum of all digits to the right of the middle digit(s) are equal. TASK : Given a number, find if it is Balanced or Not ? NOTE! - If the number has an odd number of digits then there is only one middle digit, e.g. 92645 has middle digit 6; otherwise, there are two middle digits, e.g. 1301 has middle digits 3 and 0. - The middle digit(s) should not be considered when determining whether a number is balanced or not, e.g. 413023 is a balanced number because the left sum and right sum are both 5. - Number passed is always Positive! - Return the result as String! HappyCodings!:) https://code.sololearn.com/WxJ60m8Bxjta/?ref=app

27th May 2018, 3:27 PM
Danijel Ivanović
Danijel Ivanović - avatar
25 Answers
+ 20
Yes, you are right my friend, there is no example for a two-digit number! as you say, based on the logic we can conclude! 👍😉
28th May 2018, 6:23 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 18
~ swim ~ Don't worry my friend, I know you're going to do it! 😊👍
28th May 2018, 7:10 AM
Danijel Ivanović
Danijel Ivanović - avatar
27th May 2018, 7:20 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 16
VcC Thank you very much for your suggestion! 👌😊 I believe that the tasks I set for you are pretty easy, because you are an excellent programmer and I'm glad for you! 👏👏🤓 I have not reached such a high level in programming and because of that, it is difficult for me to set up tasks that I can not solve! 👍 Thank you very much for your interest and the support you provide me, 🤗 I will try to find more difficult tasks and set them up! 😄😆😉
27th May 2018, 4:24 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 16
VcC Thank you so much for such nice words! 😉 You are right and I absolutely understand you, I really appreciate your support and I will try to find a little more interesting and harder tasks, 👍😉 Best regards my friend! 🤗
27th May 2018, 4:56 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 16
~ swim ~ balancedNum(7) --> return "Balanced" balancedNum(45) --> return "Balanced" You have examples in the web code Balanced Number [TASK] 👍😉
28th May 2018, 5:40 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 15
https://code.sololearn.com/cY4RF9LsT5VC/?ref=app
28th May 2018, 11:27 AM
LukArToDo
LukArToDo - avatar
27th May 2018, 9:50 PM
reviiea
reviiea - avatar
+ 5
Danijel Ivanović You are too nice :-D. Maybe try to think about harder stuff involving some technic that would learn people (including me) stg
27th May 2018, 4:45 PM
VcC
VcC - avatar
+ 5
Danijel Ivanović hi again! will u give feed back on my tries?! with a function, and bonus: this can return a list of balanced num within a range https://code.sololearn.com/cu05K4pg3iRD/?ref=app a python one-liner: return type string https://code.sololearn.com/c5vj935WxyG5/?ref=app another python one-liner: return type bool https://code.sololearn.com/chi2ax1iHftN/?ref=app
12th Jun 2018, 9:12 PM
Flash
+ 4
Daniel #1 challenge editor ! Could you try to add questions a little bit more complex to make them interesting for a larger audience ?
27th May 2018, 3:51 PM
VcC
VcC - avatar
27th May 2018, 3:55 PM
Louis
Louis - avatar
+ 4
three lines (couldn't pull one for this) https://code.sololearn.com/c3CJ9yFB67k8/?ref=app
27th May 2018, 8:49 PM
hinanawi
hinanawi - avatar
+ 4
https://code.sololearn.com/wmEiuE5ZUn8P/?ref=app
29th May 2018, 6:37 PM
Johann
Johann - avatar
11th Jul 2018, 7:54 AM
Salman
Salman - avatar
+ 3
Obligatory Python one-liner: https://code.sololearn.com/c4Yo60MVAkBU/#py Let me know if you can write a solution in less than 101 characters!
27th May 2018, 7:16 PM
Just A Rather Ridiculously Long Username
8th Jul 2018, 5:15 AM
Jain Rishav Amit
Jain Rishav Amit - avatar