Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a32bf77

Browse files
Update practice.py
1 parent 4e48df1 commit a32bf77

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎bits_wilp/practice.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,20 @@ def get_freq(str):
1717
result = get_freq("Amogh loves to eat apple and mango. His sister also loves eating apple and mango")
1818
print(result)
1919
# {'Amogh': 1, 'loves': 2, 'to': 1, 'eat': 1, 'apple': 2, 'and': 2, 'mango.': 1, 'His': 1, 'sister': 1, 'also': 1, 'eating': 1, 'mango': 1}
20+
21+
22+
23+
def is_prime(num):
24+
flag = 1
25+
26+
for i in range(2, num//2):
27+
if num % i == 0:
28+
flag = 0
29+
break
30+
31+
if flag == 0:
32+
print(f"{num} is not prime...")
33+
else:
34+
print(f"{num} is prime...")
35+
36+
is_prime(7919) # 7919 is prime

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /