Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# LAB_FUNCTIONS_102

## Create a function : find_primes that takes in 2 parameters of type int , and print the prime numbers between the first parameter and the second parameter .
## Create a function : find_primes that takes in 2 parameters of type int , and print the prime numbers between the first parameter and the second parameter .

### hint
a prime number i a number that is divisible only by itself and 1 (e.g. 2, 3, 5, 7, 11)
Also , you can think of it as A Prime Number is a number that cannot be made by multiplying other whole numbers

a prime number i a number that is divisible only by itself and 1 (e.g. 2, 3, 5, 7, 11)
Also , you can think of it as A Prime Number is a number that cannot be made by multiplying other whole numbers

#### for example, primes between `25` and `50` are:

```
29
31
37
41
43
47
29
31
37
41
43
47
```

# Bonus

## write a function that takes a string as a parameter

- first check that the type of the parameter is of type str
- then, it should separates the word at any capital letter and replace it with a small letter
- and should return the new modified string !
- then, it should separates the word at any capital letter and replace it with a small letter
- and should return the new modified string !

Example: `helloWorldThere` should return :
```hello world there```
`hello world there`
18 changes: 18 additions & 0 deletions bouns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@


def split_at_capitals(text):
if type(text) != str:
return "error: parameter must be a string"
result = ""
for i, ch in enumerate(text):
if 'A' <= ch <= 'Z' and i != 0:
result += " " + chr(ord(ch)+32)
else:
if 'A' <= ch <= 'Z':
result += chr(ord(ch)+32)
else:
result +=ch
return result

userinput = input("Please Enter Text You Want Split it: ")
print (split_at_capitals(userinput))
17 changes: 17 additions & 0 deletions lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def is_primes(n):
if n<2:
return False
for i in range (2, int(n**0.5), +1):
if n%i == 0:
return False
return True

def find_primes(a, b):
start = min(a, b)
end = max(a,b)

for num in range (start, end +1):
if is_primes (num):
print(num)

find_primes(25, 50)