Efficent coding or readable one


#1

I have a doubt because when i tried to solvent the projects or problems I always use a code more readable what as well longer than the teacher.
I mean for example:

  1. A readable one:

for color in colors:
count = color_count(color)
string = “Thread Shed sold {count} threads of {color} thread today.”.format(count=count, color=color)
print(string)

  1. A efficnet One:

for color in colors:
print(Thread Shed sold {count} threads of {color} thread today.".format(count=color_count(color), color=color)

just a doubt about whats better Efficient or redable one


#2

correctness and readable is more important.

These days compilers are pretty good at making most of your code more efficient without you knowing it.

When you see a severe drop in performance you might want to check your code on efficiency. Until that always put correctness and readability as top priority.

This is the opinion i formed after reading many answers on similar questions.
i.e. : readability or performance