0% found this document useful (0 votes)
3 views3 pages

Taks Python

The document contains various Python code snippets demonstrating different functionalities such as calculating the sum of digits, checking for Armstrong numbers, finding prime numbers, checking for anagrams, and performing basic arithmetic operations. It also includes examples of list manipulations and mathematical functions. Overall, the document showcases a range of programming techniques and concepts in Python.

Uploaded by

csudarshan976
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Taks Python

The document contains various Python code snippets demonstrating different functionalities such as calculating the sum of digits, checking for Armstrong numbers, finding prime numbers, checking for anagrams, and performing basic arithmetic operations. It also includes examples of list manipulations and mathematical functions. Overall, the document showcases a range of programming techniques and concepts in Python.

Uploaded by

csudarshan976
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

def fun(num):

sum=0
while num!=0:
rem=num%10
sum=sum+rem
num//=10
return sum
print("Hello")
num=int(input("Enter a Number:"))
print(f"The sum of digits in the number is {fun(num)}")

sentence="Project Jupyter is a project to develop open-source software, open standards"


a=[Link]()
print(a[4])
b=[]
for i in a:
length=len(i)
[Link](length)
print(b)
s=max(b)
print(s)
u=[Link](s)
print(a[u])

def fun(num):
sum=0
while num!=0:
rem=num%10
sum=sum+(rem**3)
num//=10
return sum
num=int(input("Enter a Number:"))
a=fun(num)
if(a==num):
print("Armstrong number")
else:
print("Not an Armstrong")

start=int(input("Starting number:"))
end=int(input("Ending Number:"))
for i in range(start,end+1):
for j in range(2,i):
if(i%j==0):
break
else:
print(i)
s1=input("Enter a string :")
s2=input("Enter a another string :")
x=list(s1)
y=list(s2)
if(sorted(x)==sorted(y)):
print(" given strings are Anagram")
else:
print("not an anagram")

list=[2,65,34,234,234,345,345,232,234]
print(sum(list)/len(list))
p=sorted(list)
val=(len(p))//2
print(p[val])

def mul(num):
for i in range(1,11):
print(f"{num} * {i} ={num*i}")
num=int(input("Enter a Number:"))
mul(num)

import math
def p(num,power):
ps=[Link](num,power)
return ps
num=int(input(":"))
power=int(input(":"))
print(p(num,power))

name="hello this is me ok bye"


s=[Link]()
print(len(s))

list=[3,345,23,45,34,34,456,45,3,23,543,3456,9]
list1=[]
for i in list:
if i not in list1:
[Link](i)
print(list1)

a=5
b=4
mul=0
for i in range(1,b+1):
mul=mul+a
print(mul)
import math
a=[Link]([2,3])
print(a)

You might also like