i was wondering if this was an efficient way to achieve the objective or not, some advice on the matter is much appreciated.

the objective is to define a function to determine the standard achieved by a participant taking a physical fitness test.

The standard is determined based on the individual and total scores for 3 stations.

gold is at least 4 at each station and a total of 13 or more.
silver is at least 3 at each station and a total of 10 or more
Pass is at least 2 at each station and 7 or more in total.
Fail is anything else.

i did the following

def Fitness(a, b, c):
	if a+b+c >= 13 and a>=4 and b>=4 and c >=4:
		return 'Gold'
	elif a+b+c >= 10 and a>=3 and b>=3 and c>=3:
		return 'Silver'
	elif a+b+c >= 7 and a>=2 and b>=2 and c>=2:
		return 'Pass'
	else:
		return 'Fail'

it seems somewhat messy to me, but im just a novice.

Efficient way is to use min and sum on list input, at least it is generalizable.

On the other hand the input is so simple, that it is possible to easily spell it out, so your solution is a valid one also. Using general function is much more complicated to code, even the result will be more reusable. This is basically a 'bins' problem. Python has also in module numpy (need to install separately, not standard library) function for that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.