I wrote it in 3 lines
getGrade=function(a,b,c){ if(((a+b+c)/3)<60){return "F"} const alphabets = [...Array(26)].map((_, i) => String.fromCharCode(97 + i)); return alphabets[Math.floor((9-Math.floor(((a+b+c)/3)/10)))].toUpperCase(); }
const grades = [[90, 'A'], [80, 'B'], [70, 'C'], [60, 'D']]const getGrade = (...ss) => {const score = ss.reduce((a,b) => a+b) / ss.lengthreturn grades.find(([s, g]) => score >= s)?.at(1) || 'F'- getGrade=function(a,b,c){
- if(((a+b+c)/3)<60){return "F"}
- const alphabets = [...Array(26)].map((_, i) => String.fromCharCode(97 + i));
- return alphabets[Math.floor((9-Math.floor(((a+b+c)/3)/10)))].toUpperCase();
- }
def sum(arr): sum = 0 for m in range(0,2): for a in range(0,2): for j in range(0,2): for e in range(0,2): for s in range(0,2): for t in range(0,2): for i in arr: for c in range(i): sum+=1 print(sum) string="majestic" d=1 for x in string: d=d*2 return int(sum/(d/4))
- def sum(arr):
if not arr:return 0return arr[len(arr)-1]+sum(arr[:-1])- sum = 0
- for m in range(0,2):
- for a in range(0,2):
- for j in range(0,2):
- for e in range(0,2):
- for s in range(0,2):
- for t in range(0,2):
- for i in arr:
- for c in range(i):
- sum+=1
- print(sum)
- string="majestic"
- d=1
- for x in string:
- d=d*2
- return int(sum/(d/4))