+ 1
How to make upper triangle pattern of prime number in python
1 2 3 5 7 11 13 17 19 23
2 Antworten
+ 4
Think logic and Try to do self.
+ 1
#PSEUDO CODE:
bool isPrime(int n)
for (i = 2; i <= n / 2; i++)
if (n%i == 0)
return false
return true
__main__
n, i = 4, 2
for (r = 0; r < n; r++)
#like given pattern
print(spaces)
for (c = r; c < n; i++)
if (isPrime(i))
print(i)
c++
print(\n)
# try to implement on your own.