diff --git a/bonus.py b/bonus.py new file mode 100644 index 0000000..14c8d30 --- /dev/null +++ b/bonus.py @@ -0,0 +1,15 @@ +#lab bonus function 102 + +def separates(string:str): + '''This function will separate the words in a string by adding a space before each uppercase letter and converting it to lowercase.''' + if not isinstance(string, str): + return "Input must be a string" + result = "" + + for char in string: + if char.isupper(): + result += " " + char.lower() + else: + result += char + return result +print(separates("helloWorldThere")) \ No newline at end of file diff --git a/lab102.py b/lab102.py new file mode 100644 index 0000000..935920f --- /dev/null +++ b/lab102.py @@ -0,0 +1,12 @@ +#lab function 102 + +def find_primes(x:int, y:int): + '''This function will find all the prime numbers between x and y''' + for number in range(x, y+1): + if number > 1: + for i in range(2, number): + if (number % i) == 0: + break + else: + print(number) +find_primes(25, 50) \ No newline at end of file