primes__galore | IITM OPPE-2 March 2022 #python #OPPE

preview_player
Показать описание
primes__galore | IITM OPPE-2 March 2022

Рекомендации по теме
Комментарии
Автор

can you check my code:


def prime(n):
count = 0
for i in range(1, n):
if n%i==0:
count+=1

if (count==1):
return 1
else:
return 0


def primes_galore(L):
s=0
x=0
for i in range(len(L)):
if prime(i)==1:
x=L[i]
if prime(x)==1:
s+=1

return s

NitinSingh-wqxg
Автор

Buddy, i guess we can use fn to solve this, it will be much easier, if we can use 2 fn to check 2 things using same fn. Nice work btw

devloper_hs
Автор

bro great save, I would not have done anything after the frustration.

NitinSingh-wqxg
Автор

Can you help with the below one if possible?
Accept two positive integers aa and bb as arguments and print a rectangular pattern that has aa lines. The first and last line should have bb stars, all other lines should have exactly two stars that are aligned with either end of the rectangle. You can assume that a, b \geq 2a, b≥2 for all test cases

gkumar
Автор

Hats off to the great presence of mind in the end! Is it possible to know where exactly was it going wrong in the initial program ?

gkumar