Python Program to Find Armstrong Number in an Interval - Complete Guide
Вставка
- Опубліковано 18 жов 2024
- In this video, learn Python Program to Find Armstrong Number in an Interval - Complete Guide. Find all the videos of the 100+ Python Programs Course in this playlist: • Python Program to Add ...
💎 Get Access to Premium Videos and Live Streams: / @wscubetech
WsCube Tech is a leading Web, Mobile App & Digital Marketing company, and institute in India.
We help businesses of all sizes to build their online presence, grow their business, and reach new heights.
👉For Digital Marketing services (Brand Building, SEO, SMO, PPC, SEM, Content Writing), Web Development and App Development solutions, visit our website: www.wscubetech...
👉Want to learn new skills and improve existing ones with in-depth and practical sessions? Enroll in our advanced online courses now and make yourself job-ready: courses.wscube...
All the courses are job-oriented, up-to-date with the latest algorithms and modules, fully practical, and provide you hands-on projects.
👉 Want to learn and acquire skills in English? Visit WsCube Tech English channel: bit.ly/2M3oYOs
📞 For more info about the courses, call us: +91-7878985501, +91-9269698122
✅ CONNECT WITH THE FOUNDER (Mr. Kushagra Bhatia) -
👉 Instagram - / kushagrabhatiaofficial
👉 LinkedIn - / kushagra-bhatia
Connect with WsCube Tech on social media for the latest offers, promos, job vacancies, and much more:
► Subscribe: bit.ly/wscubech...
► Facebook: / wscubetech.india
► Twitter: / wscubetechindia
► Instagram: / wscubetechindia
► LinkedIn : / wscubetechindia
► UA-cam: / wscubetechjodhpur
► Website: wscubetech.com
-------------------------------------| Thanks |--------------------------
#python #pythonprogramming #pythontutorials
😎Hey, thanks for watching! We’d love to know your thoughts/doubts here in the comments.
👉For professional self-paced certification courses (pre-recorded), visit: bit.ly/Pre-Recorded-Course
👉Don’t forget to SUBSCRIBE to our channel for more such videos & valuable content: bit.ly/UA-cam-WsCubeTech
def armstrong_number(number):
alpha=sum(int(item)**len(str(number))for item in str(number))
return alpha
def armstrong_sum_in_an_interval(a,b):
armstrong_number_int = []
for i in range(a,b+1):
if armstrong_number(i) == i:
armstrong_number_int.append(i)
return(armstrong_number_int)
# case for finding in interval (25,134)
print(f"armstrong in given interval is:{armstrong_sum_in_an_interval(25,154)}")
Thank you so much for this video 📸
but what if the range is from 1 to 1000 , its showing 1 to 9 in the output?
Ver Helpful........Thanks for sharing....big like 43
Sir payload ko phone m kaise copy kre
Nice video Dedi
Mam python me ek function ke aunder kitne function define kar sakate hai please tell me
Mam bataye please
Mam but 1 to upper print kar rahe hai tou tou 1 to 9 bhi print hu rahe hai but 1 to 9 is not an Armstrong number??
The above code is not well structured , use this:
def is_armstrong(number):
num_str = str(number)
num_digits = len(num_str)
armstrong_sum = sum(int(digit) ** num_digits for digit in num_str)
return armstrong_sum == number
def print_armstrong_numbers_in_range(start, end):
print(f"Armstrong numbers between {start} and {end}:")
for num in range(start, end + 1):
if is_armstrong(num):
print(num)
start_range = int(input("Enter the start of the range: "))
end_range = int(input("Enter the end of the range: "))
print_armstrong_numbers_in_range(start_range, end_range)
One to nine are also called armstrong numbers dude
@@rehanclasher115 Yes brother you are right 👍
Sir devops ke lie video bnao from bigning
1 is armstrong number or not?
m getting the outputs like 125, 153 ,216, 371, 729 for same code
lower = int(input('Enter the lower limit:'))
upper = int(input('Enter the upper limit:'))
for num in range(lower, upper+1):
order = len(str(num))
sum = 0
temp = num
while temp>0:
digit = temp%10
sum = sum+digit**order
temp//=10
if num == sum:
print(num)
First like me bro
Kachra h. Bro
Thik bujhlam na didi
💅💅💅💅💅💅💅💅💅