def primary_cubic (num) : | |
if len(num) <= 3 : | |
list_str_num = list(num) | |
try : | |
list_int_num = [int(i) for i in list_str_num ] | |
sum = 0 | |
for j in list_int_num : | |
sum += j*j*j | |
if sum == int(num) : | |
print (num , end = " ") | |
except ValueError : | |
pass | |
def secondary_cubic (string_of_num ) : | |
list_of_num = string_of_num.split( ) | |
for num in list_of_num : | |
primary_cubic(num) | |
string_of_num = input("Enter a string :") | |
secondary_cubic(string_of_num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment