We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6c3fce commit ce21cd4Copy full SHA for ce21cd4
HackerRank-Bon App-tit/Bon Appétit.py
@@ -0,0 +1,32 @@
1
+#!/bin/python3
2
+
3
+import math
4
+import os
5
+import random
6
+import re
7
+import sys
8
9
+# Complete the bonAppetit function below.
10
+def bonAppetit(bill, k, b):
11
+ count=0
12
+ for i in range(len(bill)):
13
+ if(i!=k):
14
+ count+=bill[i]
15
+ pay = count//2
16
+ if(pay != b):
17
+ print(b-pay)
18
+ else:
19
+ print("Bon Appetit")
20
21
+if __name__ == '__main__':
22
+ nk = input().rstrip().split()
23
24
+ n = int(nk[0])
25
26
+ k = int(nk[1])
27
28
+ bill = list(map(int, input().rstrip().split()))
29
30
+ b = int(input().strip())
31
32
+ bonAppetit(bill, k, b)
0 commit comments