Python programming codes
43 subscribers
25 photos
1 video
83 files
82 links
Uploading All programming codes are updating Daily
ask doubts in comment box 🎁☑️
Download Telegram
Armstrong number checking only one number

num=int(input("enter the number :"))
sum=0
temp=num
while temp>0:
digit=temp%10
sum+=digit**3
temp//=10
if num==sum:
print(num," is Armstrong number")
else:
print(num," is not Armstrong number")

Output:
enter the number :153
153 is Armstrong number

[Program finished]
#Armstrongnumbers 1 to 2000 print all numbers

lower=1
upper=2000
for num in range(lower,upper+1):
order=len(str(num))
sum=0
temp=num
while temp>0:
digit=temp%10
sum+=digit**order
temp//=10
if(num==sum):
print(num)

Output:
1
2
3
4
5
6
7
8
9
153
370
371
407
1634

[Program finished]
#largestnumber of the these three numbers

N = [2,89,567]

print(max(N))
#largestnumber of the these three numbers (enter 3 input values/Numbers)


num1 = float(input("Enter the Number"))
num2 = float(input("Enter the Number"))
num3 = float(input("Enter the Number"))

if (num1>=num2) and (num1>=num3):
largest=num1
elif (num2>=num1) and (num2>=num3):
largest=num2
else:
largest=num3

print("largest num is",largest)
#python program to check if the Number is positive, Negative and zero

num=float(input("Enter the Number: "))

if num > 0 :
print("Number is positive")
elif num < 0:
print("Number is negative")
else :
print("Number is zero")
#check if the number is even or odd

num=float(input("Enter the Number:"))

if num%2 == 0 :
print("Number is Even ")
else:
print("Number is Odd")
#check if the number is even or odd

num=float(input("Enter the Number:"))

if num%2 == 0 :
print("{0} is Even ".format(num))
else:
print("{0} is Odd".format(num))
#program to print 1 to 100 numbers
n = 100

primenumbers = [ ]
for i in range(2,100):
for j in range(2,i):
if (i%j==0):
break
else:
print(i)
primenumbers.append(i)
print("the prime numbers 1 to 100 is ",len(primenumbers))
Python group telugu
https://t.me/coding_teluguchat
#write a program to print sum of numbers 1 to n

n = int(input("Entet the number: "))

sum = 0

for i in range(1,n+1):
sum = sum + i
print("the total value of sum is 1 to {} is {}".format(n,sum))
#program to reverse a string
name = input('Enter a name : ')
print('Entered name is:',name)
#suresh
#us
#hserus
#print(name[::-1])

reverse = ""
for i in name:
reverse = i + reverse

print('Reversed value of {} is {}'.format(name,reverse))
#program to check whether a string is palindrome or not
name = input('Enter a string/name: ')
print()
print('orignal string: ',name)
print()
reversedValue = name[::-1]
print()
print('reversed string: ',reversedValue)
print()
if(name==reversedValue):
print('it is palindrome')
else:
print('it is not a palindrome')
#program for factorial of a number

n = int(input('Enter n valu : '))

if(n<0):
print('invalid number')
elif(n==0):
print('factorial of 0 is 1')
else:
mul=1
#1*2, 2*3, 6
#1*2*3*4*5
for i in range(1,n+1):
mul = mul * i

print('Factorial of {} is {}'.format(n,mul))
#program to print 1 to 2000 armstrong numbers


n=2000
for num in range(1,n+1):
order=len(str(num))
sum=0
temp=num
while temp>0:
digit=temp%10
sum+=digit**order
temp//=10
if(num==sum):
print(num)
"""Armstrong number checking only one number
source code"""
num=int(input("enter the number :"))
sum=0
temp=num
while temp>0:
digit=temp%10
sum+=digit**3
temp//=10
if num==sum:
print(num," is Armstrong number")
else:
print(num," is not Armstrong number")
#Display the calendar by using the python code

import calendar #first import the calendar library module

year = 2023 #mention the past or present or future years
month = 1 #mention the 1 to 12 month numbers ∆∆ starting with no zero (0) mention ortherwise the program error display

#then after the print operation to display the output
print(calendar.month(year,month))
#String operations first one concatenation
string1 = "Hello"
string2 = "World"
concatenated_string = string1 + " " + string2
print(concatenated_string) # "Hello World"
#String operations second one is Replication or Repeated
string = "python" #python wtihout space
repeated_string = string * 3
print(repeated_string) # "pythonpythonpython"


string = "python " #python with space
repeated_string = string * 3
print(repeated_string) # "pythonpythonpython"
#String operations third one is Indexing

string = "Hello World!"
print(string[0]) # "H"
print(string[-1]) # "!"
print(string[7]) # "o"
print(string[-7]) # " "
print(string[5]) # " "
print(string[11]) # "!"