[Solved] SQL Server : how to sum? [closed]

SELECT SUM(Value) FROM TableName; Using a GROUP BY (per your comment above) is when you want things grouped over a subset. In this case, a group by would return the same info you’ve sampled, because there’s no groups to sum on the desc field… however if you had two “e” descriptions (let’s say 40 for … Read more

[Solved] Comparing 2 lists without using “in”

>>>l1 = [i for i in range(1,25)] >>>l2 = [i for i in range(24, 50)] >>>[x for x in l1 if x in l2] [24] Sorry I misread. How about this: for i in range(len(l1)): for j in range(len(l2)): if l2[j] == l1[i]: print l2[j] If you need to add matches to a list just … Read more

[Solved] How can my html not read my js [closed]

I would assume that you want to load your javascript file from a relative path (relative to your html page) rather than an absolute path. Absolute paths start with a / (slash). Try <script src=”https://stackoverflow.com/questions/40283606/js/script1.js”></script> To debug it right click your page and click on the javascript src value. A page with the file content … Read more

[Solved] Is there a more efficient way to write multiple if else? [duplicate]

You may find this approach verbose and overengineered. Yes, it’s. Though, I like the way the grading system is defined. class Test { public static void main(String[] args) { Map<String, Predicate<Integer>> gradingSystem = new HashMap<>(); gradingSystem.put(“A”, mark -> mark >= 90 && mark <= 100); gradingSystem.put(“B”, mark -> mark >= 80 && mark < 90); … Read more

[Solved] Oops, try again. Your function failed on the message yes. It returned ‘yes’ when it should have returned ‘Shutting down’

Couple of points: Misplaced return statement. Should be at end. if yes(): It is wrong. You want to compare function input with yes. It should be if s == ‘yes’:. Same for rest also. Since you have written function definition as def shut_down(s):, it is expecting one argument. You should pass one argument while calling … Read more