+ 1

I'm a beginner. How am I doing?

I'm practicing and I made a calculator but I think it is a WET code. What do you think about this code? How can I make it shorter and more efficient? https://code.sololearn.com/cLIC65RbW8XW/?ref=app

2nd May 2020, 2:54 AM
John Larz
John Larz - avatar
1 Answer
+ 4
Yes, it is very wet. â˜ș You should start using functions, for everything. Imperative programming is the past. Look at the parts of your code that you repeat multiple times, and try to extract them to separate functions. Like printing the menu or asking for input. If there is a small change in any of those parts, consider using parameters to control which "version" of the function to run.
2nd May 2020, 3:59 AM
Tibor Santa
Tibor Santa - avatar