0

Hello.. This code work properly but it's not beautiful.. Can someone rewrite and make it more reusable and more beautiful pls ?

https://code.sololearn.com/ciee4PSl9O0f/?ref=app

27th Jun 2018, 11:31 AM
Hyp3r60l1c
Hyp3r60l1c - avatar
4 ответов
+ 1
Nahum Maurice Prepare to be amazed!!
27th Jun 2018, 1:27 PM
Qwertiony
Qwertiony - avatar
0
Why not rewriting yourself? :) You can store your menu in a Dictionary: menu = {'fruit1': price, 'fruit2': price, ...} for fruit in menu with iterate over fruits. menu['fruit1] will return the price. Your discount lines looks the same. Dont repeat your self! Try to define a function to calculate discount. def discount(fruit)
27th Jun 2018, 1:24 PM
Qwertiony
Qwertiony - avatar
0
I haven't learned the dictionaries yet.. they are my next lesson..
27th Jun 2018, 1:25 PM
Hyp3r60l1c
Hyp3r60l1c - avatar
0
Thanks for your advice Qwertiony ! 👍
27th Jun 2018, 1:27 PM
Hyp3r60l1c
Hyp3r60l1c - avatar