Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

armstrong numbers

// Armstrong Numbers
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748...
Comment

long armstrong numbers


while True:
    n = input()
    n1 = [int(d) for d in str(n)]
    a = []
    ans = 0
    for i in n1:
      a.append(i**len(n))
    for j in a:
      ans += int(j)
    if ans == int(n):
      print('This number is an armstrong number')
    elif ans != int(j):
      print("this number is not a armstrong number")
    if n == 'stop' or ans == "Stop":
      break
Comment

PREVIOUS NEXT
Code Example
Python :: Library for removal of punctuation and defining function 
Python :: odoo 12 python version 
Python :: how to access specific index of matrix in python 
Python :: tkinter screen clicked 
Python :: how to add start menu in python 
Python :: What is the right way to do such import 
Python :: Hide div element using python in Flask 
Python :: Flask/Werkzeug, how to return previous page after login 
Python :: python socket backlog 
Python :: how to wait 5 seconds in python 
Python :: check if id is present in elasticsearch using python 
Python :: best website to learn python 
Python :: ring For in Loop 
Python :: difflib get close matches 
Python :: ring Load Syntax Files 
Python :: rpi python read spi 
Python :: how to write stuff in python 
Python :: module not found after sucessful install 
Python :: modules django 
Python :: python durchschnitt liste 
Python :: screen.blit() arguments 
Python :: python get part of jason from string 
Python :: downolad fileby python requests 
Python :: how to change text in a canvas tkinter 
Python :: entry point not found python.exe 
Python :: blakyubeuiwbciwcqiby7ib.py 
Python :: else if in pyton 
Python :: when was python 3.8 released 
Python :: how do you change a class variable in python 
Python :: python inline assignment 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =