Skip to content

Instantly share code, notes, and snippets.

@piyush2896
Created November 2, 2018 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piyush2896/584a18e2d7703e5042fd13e9c4f2a368 to your computer and use it in GitHub Desktop.
Save piyush2896/584a18e2d7703e5042fd13e9c4f2a368 to your computer and use it in GitHub Desktop.
def check_armstrong(num):
cube_sum = 0
temp = num
while temp >= 0:
digit = temp % 10
cube_sum = cube_sum + digit ** 3
temp = temp / 10
return cube_sum == num
def get_max_and_index(li):
max = li[0]
index = 0
for i in range(1, len(li)):
if li[i] > max:
max = li[i]
index = i
return max, index
def sum_list(input_list):
total = input_list[0]
if len(input_list) < 2:
return total
for ele in input_list[1:]:
total = total + ele
return total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment