Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Armstrong Number Coding
00:00
5 left

Armstrong Number Coding

EasyPython

Problem

Write code for an Armstrong number.

Implement is_armstrong(number) to return True when number equals the sum of each digit raised to the total number of digits, and False otherwise. Treat 0 as an Armstrong number. The input is a non-negative integer, and the output is a Boolean.

Constraints

  • 0 <= number <= 10^9
  • The input is a base-10 integer
  • Return a Boolean value

Function Signature

def is_armstrong(number):
Interviewer

Your question is Armstrong Number Coding. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.