Clean my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Clean my code

Hi, i want to clean up my code and push some part to functions. Can you help? https://code.sololearn.com/c0Pn88Ocbp8h/?ref=app

26th Oct 2021, 11:25 PM
ElkanaM
ElkanaM - avatar
7 Answers
+ 2
I want to clean it and separate to functions. Thx, sorry if it spam/off topic.
27th Oct 2021, 12:00 AM
ElkanaM
ElkanaM - avatar
+ 2
To fix the indentation ( I don't know how you managed to get it wrong at the first place ) you can try tools like clang format. But for changing overall structure of the program, you have to do that yourself.
27th Oct 2021, 12:55 AM
Arsenic
Arsenic - avatar
+ 2
Would you consider code reduction as the type of clean up you intended? By thinking outside the box, lines 34 - 56 could be reduced to a two-line while statement. It would require no special statements beyond ones that you have used already in the given code. Hint: I mentioned the approach in response to a question earlier today about this Code Coach task.
27th Oct 2021, 3:12 AM
Brian
Brian - avatar
+ 1
ElkanaM it's fine but I feel like most people here count that as doing your work for you, so I'd recommend look over it yourself :)
27th Oct 2021, 12:13 AM
Chloe
Chloe - avatar
+ 1
Why don't you try it yourself? We will help you if you are stuck in any step. All the best =)
27th Oct 2021, 12:47 AM
Rishi
Rishi - avatar
0
Hmm, is this code advertising or are you asking for help? If it's the first one I'm afraid this is spam and off-topic.
26th Oct 2021, 11:43 PM
Chloe
Chloe - avatar