here is one way to do the above question
n=int(input('number:- '))
if n > 2:
for i in range(2,n):
if n%i==0:
print(n,'is not prime')
break
else:
print(n,'is prime')
break
elif n ==2:
print(n,'is prime')
else:
print(n,'is not prime')
https://news.1rj.ru/str/zethioprograming
n=int(input('number:- '))
if n > 2:
for i in range(2,n):
if n%i==0:
print(n,'is not prime')
break
else:
print(n,'is prime')
break
elif n ==2:
print(n,'is prime')
else:
print(n,'is not prime')
https://news.1rj.ru/str/zethioprograming
❤4
write a code that add the square of each digits in a give number
eg:- if the given number is 111 then the out put is 3 if it is 23 the out put is 13.
https://news.1rj.ru/str/zethioprograming
eg:- if the given number is 111 then the out put is 3 if it is 23 the out put is 13.
https://news.1rj.ru/str/zethioprograming
❤2👍2
here is the solution for the above problem
def sum_squared(n):
sum=0
while n>0:
no=n%10
sum=sum+no**2
n=n//10
print(sum)
https://news.1rj.ru/str/zethioprograming
n=int(input(' '))
sum_squared(n)
def sum_squared(n):
sum=0
while n>0:
no=n%10
sum=sum+no**2
n=n//10
print(sum)
https://news.1rj.ru/str/zethioprograming
n=int(input(' '))
sum_squared(n)
❤5
#out put
2
4
6
8
we have four even numbers
#write a code for the above out put
https://news.1rj.ru/str/zethioprograming
2
4
6
8
we have four even numbers
#write a code for the above out put
https://news.1rj.ru/str/zethioprograming
🏆3
Forwarded from Bitanya
def even(n):
ctr=0
for i in range (1,n):
if i%2==0:
ctr +=1
print(i)
print(f“we have {ctr} even numbers”)
even(10)
ctr=0
for i in range (1,n):
if i%2==0:
ctr +=1
print(i)
print(f“we have {ctr} even numbers”)
even(10)
Forwarded from ᴀʜᴍᴇᴅ
Leetcode with dani
def even(n): ctr=0 for i in range (1,n): if i%2==0: ctr +=1 print(i) print(f“we have {ctr} even numbers”) even(10)
n = int(input('number: '))
total = 0
for i in range(2,n,2):
print(i)
total +=1
print(f'we have {total} even numbers')
total = 0
for i in range(2,n,2):
print(i)
total +=1
print(f'we have {total} even numbers')
write a program that generate 7 random number in the form of list from one ab to 9.
from the comments
#in the form of list
import random
def easy():
lis = []
i = 0
while i < 7:
lis.append(random.randint(1,9))
i+=1
print(lis)
easy()
#in the form of list
import random
def easy():
lis = []
i = 0
while i < 7:
lis.append(random.randint(1,9))
i+=1
print(lis)
easy()
write a program that count number of odd number in the given number.
example:- input=3687 .#output=2
example:- input=3687 .#output=2
Leetcode with dani
write a program that count number of odd number in the given number. example:- input=3687 .#output=2
n=int(input('number:'))
num=0
if n < 0:
n=-n
while n > 0:
no=n%10
if no % 2 != 0:
num+=1
n=n//10
print(num)
num=0
if n < 0:
n=-n
while n > 0:
no=n%10
if no % 2 != 0:
num+=1
n=n//10
print(num)
👍3
❤🔥3👎2
Anonymous Quiz
13%
(3,2,3)
53%
(3,(2,3))
15%
(T1,2,3)
18%
error
kemejemria jmro python memar mefelgu sewoch ke first message gemrachu mayet techlalachu keza betechemari be mangnawm seat erdata kefelegachu conatct argugn https://news.1rj.ru/str/zprogramming_bot
❤🔥7
🇪🇹Ethio Apps Store 📀
Python_4.2.21_Pro.apk
be slk lemetemaru kesr yalwn tetekemu yelayegnaw kalseralachu
Forwarded from Leetcode with dani
Pydroid 3_6.4_arm_premium.apk
53.5 MB