Armstrong Program in Python | Reverse Number or String Program in Python | Palindrome String or Number Program in Python
#palindrome #armstrong #reverse #computerscience #python #programming #coder #codinglife #btech #technology #programminglanguages
Code of this Video:
-----------------------------------------------------------------------------------------------------------------------
1# Write a program to check whether a Number is Armstrong Number or Not!
153 = 1**3 + 5**3 + 3**3
1 + 125 + 27
num = int(input('Enter a Number: '))
temp = num
sum = 0
while temp > 0:
digit = temp % 10 #153/10 remainder 3, 15/10 remainder 5
sum += digit**3
temp //= 10 #153/10 Quotient 15, 15/10 quotient 1
if sum == num:
print(f'{num} is Armstrong Number')
else:
print(f'{num} is Not Armstrong Number')
2# Write a program to find Reverse a Number
Write a program to find Reverse of a String.
Reverse String Example
var_String = "CodeFactory"
rev = var_String[::-1]
print(f'Reverse string of {var_String} is {rev}')
Reverse Number Example
var_num = 54321
temp = var_num
rev = 0
while temp != 0:
digit = temp % 10
rev = rev*10 + digit
temp //= 10
print(f'Reverse number of {var_num} is {rev}')
3# Write a program to check a number is Palindrome or not.
Write a program to check a String is Palindrome or not.
Palindrome String Example
'madam', 'racecar' is palindrome String
var_string = input("Enter String: ")
rev = var_string[::-1]
if rev == var_string:
print(f'{var_string} is a Palindrome')
else:
print(f'{var_string} is not a Palindrome')
Palindrome Number Example
15351 is palindrome Number
var_num = int(input("Enter a Number: "))
temp = var_num
rev = 0
while temp != 0:
digit = temp % 10
rev = rev*10 + digit
temp //= 10
if rev == var_num:
print(f'{var_num} is a Palindrome')
else:
print(f'{var_num} is not a Palindrome')
-----------------------------------------------------------------------------------------------------------------------
Playlist Link:
• Learn Python By Awesome Examples in H...
Videos in Playlist :
1) Learn Python by Examples in Hindi | Install Visual Studio | Getting Input from User | Basic Programs
• Learn Python by Examples in Hindi | I...
2) Python as a Calculator | Python Calculator | Quick Calculation by Python
• Python as a Calculator | Python Calcu...
3)Swapping Program of two number | Find Square Root of a Number | Check whether a no. is +ve or -ve
• Swapping Program of two number | Find...
4) Print Fibonacci Series | Find Simple Interest in Python | Check Whether a number is Even or Odd
• Print Fibonacci Series | Find Simple ...
5) Factorial Program in Python | Sum of Natural Number in Python | Largest Number Program in Python
• Factorial Program in Python | Sum of ...
Video on Channel:
1) What is HTML in Hindi and Intro About HTML.
• What is HTML in Hindi and Intro About...
2) HTML Elements and Tags | html elements explained in hindi | basic html elements class 10
• HTML Elements and Tags | html element...
3) What is Tkinter in Hindi? | Tkinter in Python | Tkinter modern GUI | What is the use of Tkinter?
• What is Tkinter in Hindi? | Tkinter i...
4) How to Increase Text Size in Python IDLE | Python IDLE | Python for Beginners
• How to Increase Text Size in Python I...
facebook: facebook.com/codefactory98
instagram: @codefactory98
#programmers #coders #computerscience #viral #youtubers #youtube #viralvideo #trends #trending #jobs #interview