diff --git a/nine/lekan/ai_calculator.py b/nine/lekan/ai_calculator.py new file mode 100644 index 0000000..41af650 --- /dev/null +++ b/nine/lekan/ai_calculator.py @@ -0,0 +1,15 @@ +from chatterbot import ChatBot + +Bot = ChatBot(name='Calculator', + read_only=True, + logic_adapters=["chatterbot.logic.MathematicalEvaluation"], + storage_adapters="chatterbot.storage.SQLStorageAdapter") + +print('\033c') +print("Hello, I am a calculator. How may I help you?") +while(True): + user_input = input("me: ") + + if user_input.lower() == 'quit': + print("Exiting") + break diff --git a/nine/lekan/birthday_cakes.py b/nine/lekan/birthday_cakes.py new file mode 100644 index 0000000..06aa572 --- /dev/null +++ b/nine/lekan/birthday_cakes.py @@ -0,0 +1,13 @@ +import sys +def birhtdayCakeCandles(candles): + count = 0 + temp = candles[0] + for i in range(1, len(candles)): + if candles[i] > temp: + temp = candles[i] + + for i in range(0, len(candles)): + if candles[i] == temp: + count += 1 + return c + diff --git a/nine/lekan/chapter_four/args.py b/nine/lekan/chapter_four/args.py new file mode 100644 index 0000000..1a4c1e8 --- /dev/null +++ b/nine/lekan/chapter_four/args.py @@ -0,0 +1,19 @@ +def average(*args): + return sum(args) / len(args) + + +print(average(2, 3, 4)) + + +def calculate_product(*args): + product = 1 + for values in args: + product *= values + return product + + +print(calculate_product(10, 20, 30)) + +s = 3 / 2 + +print(s) diff --git a/nine/lekan/chapter_four/average_functions.py b/nine/lekan/chapter_four/average_functions.py new file mode 100644 index 0000000..e69de29 diff --git a/nine/lekan/chapter_four/computer_aided_instruction.py b/nine/lekan/chapter_four/computer_aided_instruction.py new file mode 100644 index 0000000..89652d1 --- /dev/null +++ b/nine/lekan/chapter_four/computer_aided_instruction.py @@ -0,0 +1,13 @@ +def calculate_products(myList): + product = 1 + for value in myList: + product *= value + return product + +number_list = [] +count = int(input('Enter the number of input: ')) +for i in range(0, count): + user_input = int(input("Enter A Number:")) + number_list.append(user_input) + +print(calculate_products(number_list)) diff --git a/nine/lekan/chapter_four/cube.py b/nine/lekan/chapter_four/cube.py new file mode 100644 index 0000000..093c2d9 --- /dev/null +++ b/nine/lekan/chapter_four/cube.py @@ -0,0 +1,5 @@ +def cube(x): + return x ** 3 + + +print('The cube of 2 is', cube(2)) diff --git a/nine/lekan/chapter_four/date_and_time.py b/nine/lekan/chapter_four/date_and_time.py new file mode 100644 index 0000000..324d060 --- /dev/null +++ b/nine/lekan/chapter_four/date_and_time.py @@ -0,0 +1,8 @@ +import datetime + + +def date_time(): + print(datetime.datetime.today()) + + +print(date_time()) diff --git a/nine/lekan/chapter_four/guessing_number.py b/nine/lekan/chapter_four/guessing_number.py new file mode 100644 index 0000000..7b3f631 --- /dev/null +++ b/nine/lekan/chapter_four/guessing_number.py @@ -0,0 +1,16 @@ +import random +from random import Random + +randoms = random.randrange(1, 1001) + +userInput = int(input('Guess the number between 1 and 1000 with the fewest guesses')) + +while userInput != randoms: + + if userInput == randoms: + print('Congratulations. You guessed the number ') + elif userInput > randoms: + print('Too High Try Again') + elif userInput < randoms: + print("Too low. Try again") + userInput = int(input('Guess the number between 1 and 1000 with the fewest guesses')) diff --git a/nine/lekan/chapter_four/missing_code.py b/nine/lekan/chapter_four/missing_code.py new file mode 100644 index 0000000..db73401 --- /dev/null +++ b/nine/lekan/chapter_four/missing_code.py @@ -0,0 +1,8 @@ +def seconds_since_midnight(hour, minutes, second): + hour_in_seconds = 3600 + minute_in_seconds = 60 + return (hour * hour_in_seconds) + (minute_in_seconds * minutes) + second + + +result = seconds_since_midnight(13, 30, 45) +print(result) diff --git a/nine/lekan/chapter_four/mystery.py b/nine/lekan/chapter_four/mystery.py new file mode 100644 index 0000000..c1f4675 --- /dev/null +++ b/nine/lekan/chapter_four/mystery.py @@ -0,0 +1,10 @@ +def mystery(x): + y = 0 + for value in x: + y += value ** 2 + return y + + +value = [1, 2, 3, 4, 5] +print(mystery(value)) + diff --git a/nine/lekan/chapter_four/rolling_a_die.py b/nine/lekan/chapter_four/rolling_a_die.py new file mode 100644 index 0000000..b899be4 --- /dev/null +++ b/nine/lekan/chapter_four/rolling_a_die.py @@ -0,0 +1,32 @@ +import random +frequency1 = 0 +frequency2 = 0 +frequency3 = 0 +frequency4 = 0 +frequency5 = 0 +frequency6 = 0 + +for roll in range(6_000_000): + face = random.randrange(1, 7) + + if face == 1: + frequency1 += 1 + elif face == 2: + frequency2 += 1 + elif face == 3: + frequency3 += 1 + elif face == 4: + frequency4 += 1 + elif face == 5: + frequency5 += 1 + elif face == 6: + frequency6 += 1 + +print(f'Face{"Frequency":>13}') +print(f'{"1":>4}{frequency1:>13}') +print(f'{"2":>4}{frequency2:>13}') +print(f'{"3":>4}{frequency3:>13}') +print(f'{"4":>4}{frequency4:>13}') +print(f'{"5":>4}{frequency5:>13}') +print(f'{"6":>4}{frequency6:>13}') + diff --git a/nine/lekan/chapter_four/temperature_conversion.py b/nine/lekan/chapter_four/temperature_conversion.py new file mode 100644 index 0000000..4f441b6 --- /dev/null +++ b/nine/lekan/chapter_four/temperature_conversion.py @@ -0,0 +1,8 @@ +def fahrenheit(celsius): + return (9 / 5) * celsius + 32 + + +print('Celsius\t\tFahrenheit') +for i in range(101): + + print(i, '\t\t\t\t', fahrenheit(i)) diff --git a/nine/lekan/classes/something.py b/nine/lekan/classes/something.py new file mode 100644 index 0000000..c4d5046 --- /dev/null +++ b/nine/lekan/classes/something.py @@ -0,0 +1,3 @@ +import json + +data = open("C:\Users\ADMIN\Documents\data.json") diff --git a/nine/lekan/classes/student.py b/nine/lekan/classes/student.py new file mode 100644 index 0000000..db14d22 --- /dev/null +++ b/nine/lekan/classes/student.py @@ -0,0 +1,28 @@ +class Student: + def __init__(self,student_name, student_mark): + self.student_name = student_name + self.student_mark = student_mark + + def print(self): + print('The student name is ' + self.student_name) + print('The student mark is ' , int(self.student_mark)) + + +students = Student('Jack', 60) +students.print() +judith = Student('Judith', 90) +judith.print() + + +class NewStudent: + def __init__(self, student_id,student_name ): + self.student_name = student_name + self.student_id = student_id + + +student_data = NewStudent(1,"Inc") +print(student_data.__dict__) +student_data.__setattr__("student_class", "Cohort 1") +print(student_data.__dict__) +student_data.__delattr__("student_name") +print(student_data.__dict__) \ No newline at end of file diff --git a/nine/lekan/compare_triplets.py b/nine/lekan/compare_triplets.py new file mode 100644 index 0000000..750a089 --- /dev/null +++ b/nine/lekan/compare_triplets.py @@ -0,0 +1,19 @@ +a = [1, 2, 3] +b = [3, 2, 1] + + +def compare(c, d): + a_point = 0 + b_point = 0 + for i in range(len(c)): + if c[i] > d[i]: + a_point += 1 + elif c[i] == d[i]: + a_point += 0 + b_point += 0 + else: + b_point += 1 + return [a_point, b_point] + + +print(compare(a, b)) diff --git a/nine/lekan/credit_card_validation/credit_card_validation.py b/nine/lekan/credit_card_validation/credit_card_validation.py new file mode 100644 index 0000000..b27a243 --- /dev/null +++ b/nine/lekan/credit_card_validation/credit_card_validation.py @@ -0,0 +1,47 @@ +def isvalid(account_number): + card_is_valid = (13 <= len(account_number) <= 16 + ) and (account_number.startswith("4") or account_number.startsWith( + "5") or account_number.startsWith( + "37") or account_number.startsWith("6")) and ((sum_of_double_even_place(account_number) + + sum_of_odd_place_number(account_number)) % 10 + == 0) + + return card_is_valid + + +def sum_of_double_even_place(number): + sum = 0 + for i in range(len(number) - 2, 0, -2): + sum += get_digit(int(number[i]) * 2) + return sum + + +def get_digit(num): + number_is_less_than_nine = num < 9 + if number_is_less_than_nine: + return num + else: + return (num // 10) + (num % 10) + + +def sum_of_odd_place_number(number): + sum = 0 + for i in range(len(number) - 1, 0, -1): + sum += int(number[i] + " ") + return sum + + +def prefix_matched(number, prefix): + prefix = ("4", "5", "37", "6") + + if number.startswith(prefix): + return True + else: + return False + + +def get_size(d): + return d.len() + + +print(isvalid("4388576018410707")) diff --git a/nine/lekan/dictionary/__init__.py b/nine/lekan/dictionary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nine/lekan/dictionary/user_data.py b/nine/lekan/dictionary/user_data.py new file mode 100644 index 0000000..90858a3 --- /dev/null +++ b/nine/lekan/dictionary/user_data.py @@ -0,0 +1,547 @@ + +data= [ + { + "login": "gentlesolo", + "id": 5492998, + "node_id": "MDQ6VXNlcjU0OTI5OTg=", + "avatar_url": "https://avatars.githubusercontent.com/u/5492998?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gentlesolo", + "html_url": "https://github.com/gentlesolo", + "followers_url": "https://api.github.com/users/gentlesolo/followers", + "following_url": "https://api.github.com/users/gentlesolo/following{/other_user}", + "gists_url": "https://api.github.com/users/gentlesolo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gentlesolo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gentlesolo/subscriptions", + "organizations_url": "https://api.github.com/users/gentlesolo/orgs", + "repos_url": "https://api.github.com/users/gentlesolo/repos", + "events_url": "https://api.github.com/users/gentlesolo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gentlesolo/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "daunikman", + "id": 8968140, + "node_id": "MDQ6VXNlcjg5NjgxNDA=", + "avatar_url": "https://avatars.githubusercontent.com/u/8968140?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/daunikman", + "html_url": "https://github.com/daunikman", + "followers_url": "https://api.github.com/users/daunikman/followers", + "following_url": "https://api.github.com/users/daunikman/following{/other_user}", + "gists_url": "https://api.github.com/users/daunikman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/daunikman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/daunikman/subscriptions", + "organizations_url": "https://api.github.com/users/daunikman/orgs", + "repos_url": "https://api.github.com/users/daunikman/repos", + "events_url": "https://api.github.com/users/daunikman/events{/privacy}", + "received_events_url": "https://api.github.com/users/daunikman/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "ehizman", + "id": 23247186, + "node_id": "MDQ6VXNlcjIzMjQ3MTg2", + "avatar_url": "https://avatars.githubusercontent.com/u/23247186?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ehizman", + "html_url": "https://github.com/ehizman", + "followers_url": "https://api.github.com/users/ehizman/followers", + "following_url": "https://api.github.com/users/ehizman/following{/other_user}", + "gists_url": "https://api.github.com/users/ehizman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ehizman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ehizman/subscriptions", + "organizations_url": "https://api.github.com/users/ehizman/orgs", + "repos_url": "https://api.github.com/users/ehizman/repos", + "events_url": "https://api.github.com/users/ehizman/events{/privacy}", + "received_events_url": "https://api.github.com/users/ehizman/received_events", + "type": "User", + "site_admin" :False + }, + { + "login": "Olaoluolowe", + "id": 24969588, + "node_id": "MDQ6VXNlcjI0OTY5NTg4", + "avatar_url": "https://avatars.githubusercontent.com/u/24969588?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Olaoluolowe", + "html_url": "https://github.com/Olaoluolowe", + "followers_url": "https://api.github.com/users/Olaoluolowe/followers", + "following_url": "https://api.github.com/users/Olaoluolowe/following{/other_user}", + "gists_url": "https://api.github.com/users/Olaoluolowe/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Olaoluolowe/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Olaoluolowe/subscriptions", + "organizations_url": "https://api.github.com/users/Olaoluolowe/orgs", + "repos_url": "https://api.github.com/users/Olaoluolowe/repos", + "events_url": "https://api.github.com/users/Olaoluolowe/events{/privacy}", + "received_events_url": "https://api.github.com/users/Olaoluolowe/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "hedreez09", + "id": 29062895, + "node_id": "MDQ6VXNlcjI5MDYyODk1", + "avatar_url": "https://avatars.githubusercontent.com/u/29062895?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hedreez09", + "html_url": "https://github.com/hedreez09", + "followers_url": "https://api.github.com/users/hedreez09/followers", + "following_url": "https://api.github.com/users/hedreez09/following{/other_user}", + "gists_url": "https://api.github.com/users/hedreez09/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hedreez09/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hedreez09/subscriptions", + "organizations_url": "https://api.github.com/users/hedreez09/orgs", + "repos_url": "https://api.github.com/users/hedreez09/repos", + "events_url": "https://api.github.com/users/hedreez09/events{/privacy}", + "received_events_url": "https://api.github.com/users/hedreez09/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "solutionCraftsman", + "id": 29656757, + "node_id": "MDQ6VXNlcjI5NjU2NzU3", + "avatar_url": "https://avatars.githubusercontent.com/u/29656757?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/solutionCraftsman", + "html_url": "https://github.com/solutionCraftsman", + "followers_url": "https://api.github.com/users/solutionCraftsman/followers", + "following_url": "https://api.github.com/users/solutionCraftsman/following{/other_user}", + "gists_url": "https://api.github.com/users/solutionCraftsman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/solutionCraftsman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/solutionCraftsman/subscriptions", + "organizations_url": "https://api.github.com/users/solutionCraftsman/orgs", + "repos_url": "https://api.github.com/users/solutionCraftsman/repos", + "events_url": "https://api.github.com/users/solutionCraftsman/events{/privacy}", + "received_events_url": "https://api.github.com/users/solutionCraftsman/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "CaptainBKola", + "id": 31166533, + "node_id": "MDQ6VXNlcjMxMTY2NTMz", + "avatar_url": "https://avatars.githubusercontent.com/u/31166533?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/CaptainBKola", + "html_url": "https://github.com/CaptainBKola", + "followers_url": "https://api.github.com/users/CaptainBKola/followers", + "following_url": "https://api.github.com/users/CaptainBKola/following{/other_user}", + "gists_url": "https://api.github.com/users/CaptainBKola/gists{/gist_id}", + "starred_url": "https://api.github.com/users/CaptainBKola/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/CaptainBKola/subscriptions", + "organizations_url": "https://api.github.com/users/CaptainBKola/orgs", + "repos_url": "https://api.github.com/users/CaptainBKola/repos", + "events_url": "https://api.github.com/users/CaptainBKola/events{/privacy}", + "received_events_url": "https://api.github.com/users/CaptainBKola/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "momah95", + "id": 37146344, + "node_id": "MDQ6VXNlcjM3MTQ2MzQ0", + "avatar_url": "https://avatars.githubusercontent.com/u/37146344?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/momah95", + "html_url": "https://github.com/momah95", + "followers_url": "https://api.github.com/users/momah95/followers", + "following_url": "https://api.github.com/users/momah95/following{/other_user}", + "gists_url": "https://api.github.com/users/momah95/gists{/gist_id}", + "starred_url": "https://api.github.com/users/momah95/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/momah95/subscriptions", + "organizations_url": "https://api.github.com/users/momah95/orgs", + "repos_url": "https://api.github.com/users/momah95/repos", + "events_url": "https://api.github.com/users/momah95/events{/privacy}", + "received_events_url": "https://api.github.com/users/momah95/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "isholajanet", + "id": 39619383, + "node_id": "MDQ6VXNlcjM5NjE5Mzgz", + "avatar_url": "https://avatars.githubusercontent.com/u/39619383?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/isholajanet", + "html_url": "https://github.com/isholajanet", + "followers_url": "https://api.github.com/users/isholajanet/followers", + "following_url": "https://api.github.com/users/isholajanet/following{/other_user}", + "gists_url": "https://api.github.com/users/isholajanet/gists{/gist_id}", + "starred_url": "https://api.github.com/users/isholajanet/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/isholajanet/subscriptions", + "organizations_url": "https://api.github.com/users/isholajanet/orgs", + "repos_url": "https://api.github.com/users/isholajanet/repos", + "events_url": "https://api.github.com/users/isholajanet/events{/privacy}", + "received_events_url": "https://api.github.com/users/isholajanet/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "Debagboola", + "id": 40859055, + "node_id": "MDQ6VXNlcjQwODU5MDU1", + "avatar_url": "https://avatars.githubusercontent.com/u/40859055?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Debagboola", + "html_url": "https://github.com/Debagboola", + "followers_url": "https://api.github.com/users/Debagboola/followers", + "following_url": "https://api.github.com/users/Debagboola/following{/other_user}", + "gists_url": "https://api.github.com/users/Debagboola/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Debagboola/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Debagboola/subscriptions", + "organizations_url": "https://api.github.com/users/Debagboola/orgs", + "repos_url": "https://api.github.com/users/Debagboola/repos", + "events_url": "https://api.github.com/users/Debagboola/events{/privacy}", + "received_events_url": "https://api.github.com/users/Debagboola/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "IbidapoOlalekan", + "id": 41305811, + "node_id": "MDQ6VXNlcjQxMzA1ODEx", + "avatar_url": "https://avatars.githubusercontent.com/u/41305811?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/IbidapoOlalekan", + "html_url": "https://github.com/IbidapoOlalekan", + "followers_url": "https://api.github.com/users/IbidapoOlalekan/followers", + "following_url": "https://api.github.com/users/IbidapoOlalekan/following{/other_user}", + "gists_url": "https://api.github.com/users/IbidapoOlalekan/gists{/gist_id}", + "starred_url": "https://api.github.com/users/IbidapoOlalekan/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/IbidapoOlalekan/subscriptions", + "organizations_url": "https://api.github.com/users/IbidapoOlalekan/orgs", + "repos_url": "https://api.github.com/users/IbidapoOlalekan/repos", + "events_url": "https://api.github.com/users/IbidapoOlalekan/events{/privacy}", + "received_events_url": "https://api.github.com/users/IbidapoOlalekan/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "tboydv1", + "id": 45124633, + "node_id": "MDQ6VXNlcjQ1MTI0NjMz", + "avatar_url": "https://avatars.githubusercontent.com/u/45124633?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tboydv1", + "html_url": "https://github.com/tboydv1", + "followers_url": "https://api.github.com/users/tboydv1/followers", + "following_url": "https://api.github.com/users/tboydv1/following{/other_user}", + "gists_url": "https://api.github.com/users/tboydv1/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tboydv1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tboydv1/subscriptions", + "organizations_url": "https://api.github.com/users/tboydv1/orgs", + "repos_url": "https://api.github.com/users/tboydv1/repos", + "events_url": "https://api.github.com/users/tboydv1/events{/privacy}", + "received_events_url": "https://api.github.com/users/tboydv1/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "Patrick5455", + "id": 46347439, + "node_id": "MDQ6VXNlcjQ2MzQ3NDM5", + "avatar_url": "https://avatars.githubusercontent.com/u/46347439?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Patrick5455", + "html_url": "https://github.com/Patrick5455", + "followers_url": "https://api.github.com/users/Patrick5455/followers", + "following_url": "https://api.github.com/users/Patrick5455/following{/other_user}", + "gists_url": "https://api.github.com/users/Patrick5455/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Patrick5455/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Patrick5455/subscriptions", + "organizations_url": "https://api.github.com/users/Patrick5455/orgs", + "repos_url": "https://api.github.com/users/Patrick5455/repos", + "events_url": "https://api.github.com/users/Patrick5455/events{/privacy}", + "received_events_url": "https://api.github.com/users/Patrick5455/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "itunuelijah", + "id": 46831122, + "node_id": "MDQ6VXNlcjQ2ODMxMTIy", + "avatar_url": "https://avatars.githubusercontent.com/u/46831122?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/itunuelijah", + "html_url": "https://github.com/itunuelijah", + "followers_url": "https://api.github.com/users/itunuelijah/followers", + "following_url": "https://api.github.com/users/itunuelijah/following{/other_user}", + "gists_url": "https://api.github.com/users/itunuelijah/gists{/gist_id}", + "starred_url": "https://api.github.com/users/itunuelijah/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/itunuelijah/subscriptions", + "organizations_url": "https://api.github.com/users/itunuelijah/orgs", + "repos_url": "https://api.github.com/users/itunuelijah/repos", + "events_url": "https://api.github.com/users/itunuelijah/events{/privacy}", + "received_events_url": "https://api.github.com/users/itunuelijah/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "akinleries", + "id": 47524901, + "node_id": "MDQ6VXNlcjQ3NTI0OTAx", + "avatar_url": "https://avatars.githubusercontent.com/u/47524901?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/akinleries", + "html_url": "https://github.com/akinleries", + "followers_url": "https://api.github.com/users/akinleries/followers", + "following_url": "https://api.github.com/users/akinleries/following{/other_user}", + "gists_url": "https://api.github.com/users/akinleries/gists{/gist_id}", + "starred_url": "https://api.github.com/users/akinleries/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/akinleries/subscriptions", + "organizations_url": "https://api.github.com/users/akinleries/orgs", + "repos_url": "https://api.github.com/users/akinleries/repos", + "events_url": "https://api.github.com/users/akinleries/events{/privacy}", + "received_events_url": "https://api.github.com/users/akinleries/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "kareemmonsur", + "id": 47614910, + "node_id": "MDQ6VXNlcjQ3NjE0OTEw", + "avatar_url": "https://avatars.githubusercontent.com/u/47614910?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kareemmonsur", + "html_url": "https://github.com/kareemmonsur", + "followers_url": "https://api.github.com/users/kareemmonsur/followers", + "following_url": "https://api.github.com/users/kareemmonsur/following{/other_user}", + "gists_url": "https://api.github.com/users/kareemmonsur/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kareemmonsur/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kareemmonsur/subscriptions", + "organizations_url": "https://api.github.com/users/kareemmonsur/orgs", + "repos_url": "https://api.github.com/users/kareemmonsur/repos", + "events_url": "https://api.github.com/users/kareemmonsur/events{/privacy}", + "received_events_url": "https://api.github.com/users/kareemmonsur/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "Akinolae", + "id": 48059516, + "node_id": "MDQ6VXNlcjQ4MDU5NTE2", + "avatar_url": "https://avatars.githubusercontent.com/u/48059516?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Akinolae", + "html_url": "https://github.com/Akinolae", + "followers_url": "https://api.github.com/users/Akinolae/followers", + "following_url": "https://api.github.com/users/Akinolae/following{/other_user}", + "gists_url": "https://api.github.com/users/Akinolae/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Akinolae/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Akinolae/subscriptions", + "organizations_url": "https://api.github.com/users/Akinolae/orgs", + "repos_url": "https://api.github.com/users/Akinolae/repos", + "events_url": "https://api.github.com/users/Akinolae/events{/privacy}", + "received_events_url": "https://api.github.com/users/Akinolae/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "dabreeze", + "id": 48369515, + "node_id": "MDQ6VXNlcjQ4MzY5NTE1", + "avatar_url": "https://avatars.githubusercontent.com/u/48369515?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dabreeze", + "html_url": "https://github.com/dabreeze", + "followers_url": "https://api.github.com/users/dabreeze/followers", + "following_url": "https://api.github.com/users/dabreeze/following{/other_user}", + "gists_url": "https://api.github.com/users/dabreeze/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dabreeze/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dabreeze/subscriptions", + "organizations_url": "https://api.github.com/users/dabreeze/orgs", + "repos_url": "https://api.github.com/users/dabreeze/repos", + "events_url": "https://api.github.com/users/dabreeze/events{/privacy}", + "received_events_url": "https://api.github.com/users/dabreeze/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "oolabisi", + "id": 50625324, + "node_id": "MDQ6VXNlcjUwNjI1MzI0", + "avatar_url": "https://avatars.githubusercontent.com/u/50625324?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/oolabisi", + "html_url": "https://github.com/oolabisi", + "followers_url": "https://api.github.com/users/oolabisi/followers", + "following_url": "https://api.github.com/users/oolabisi/following{/other_user}", + "gists_url": "https://api.github.com/users/oolabisi/gists{/gist_id}", + "starred_url": "https://api.github.com/users/oolabisi/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/oolabisi/subscriptions", + "organizations_url": "https://api.github.com/users/oolabisi/orgs", + "repos_url": "https://api.github.com/users/oolabisi/repos", + "events_url": "https://api.github.com/users/oolabisi/events{/privacy}", + "received_events_url": "https://api.github.com/users/oolabisi/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "SimNinwo", + "id": 50625397, + "node_id": "MDQ6VXNlcjUwNjI1Mzk3", + "avatar_url": "https://avatars.githubusercontent.com/u/50625397?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/SimNinwo", + "html_url": "https://github.com/SimNinwo", + "followers_url": "https://api.github.com/users/SimNinwo/followers", + "following_url": "https://api.github.com/users/SimNinwo/following{/other_user}", + "gists_url": "https://api.github.com/users/SimNinwo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/SimNinwo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/SimNinwo/subscriptions", + "organizations_url": "https://api.github.com/users/SimNinwo/orgs", + "repos_url": "https://api.github.com/users/SimNinwo/repos", + "events_url": "https://api.github.com/users/SimNinwo/events{/privacy}", + "received_events_url": "https://api.github.com/users/SimNinwo/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "gbemme", + "id": 50625401, + "node_id": "MDQ6VXNlcjUwNjI1NDAx", + "avatar_url": "https://avatars.githubusercontent.com/u/50625401?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gbemme", + "html_url": "https://github.com/gbemme", + "followers_url": "https://api.github.com/users/gbemme/followers", + "following_url": "https://api.github.com/users/gbemme/following{/other_user}", + "gists_url": "https://api.github.com/users/gbemme/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gbemme/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gbemme/subscriptions", + "organizations_url": "https://api.github.com/users/gbemme/orgs", + "repos_url": "https://api.github.com/users/gbemme/repos", + "events_url": "https://api.github.com/users/gbemme/events{/privacy}", + "received_events_url": "https://api.github.com/users/gbemme/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "PastorCoder", + "id": 50626194, + "node_id": "MDQ6VXNlcjUwNjI2MTk0", + "avatar_url": "https://avatars.githubusercontent.com/u/50626194?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/PastorCoder", + "html_url": "https://github.com/PastorCoder", + "followers_url": "https://api.github.com/users/PastorCoder/followers", + "following_url": "https://api.github.com/users/PastorCoder/following{/other_user}", + "gists_url": "https://api.github.com/users/PastorCoder/gists{/gist_id}", + "starred_url": "https://api.github.com/users/PastorCoder/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/PastorCoder/subscriptions", + "organizations_url": "https://api.github.com/users/PastorCoder/orgs", + "repos_url": "https://api.github.com/users/PastorCoder/repos", + "events_url": "https://api.github.com/users/PastorCoder/events{/privacy}", + "received_events_url": "https://api.github.com/users/PastorCoder/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "emperorsegxy", + "id": 51512956, + "node_id": "MDQ6VXNlcjUxNTEyOTU2", + "avatar_url": "https://avatars.githubusercontent.com/u/51512956?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/emperorsegxy", + "html_url": "https://github.com/emperorsegxy", + "followers_url": "https://api.github.com/users/emperorsegxy/followers", + "following_url": "https://api.github.com/users/emperorsegxy/following{/other_user}", + "gists_url": "https://api.github.com/users/emperorsegxy/gists{/gist_id}", + "starred_url": "https://api.github.com/users/emperorsegxy/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/emperorsegxy/subscriptions", + "organizations_url": "https://api.github.com/users/emperorsegxy/orgs", + "repos_url": "https://api.github.com/users/emperorsegxy/repos", + "events_url": "https://api.github.com/users/emperorsegxy/events{/privacy}", + "received_events_url": "https://api.github.com/users/emperorsegxy/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "Oviep", + "id": 53795498, + "node_id": "MDQ6VXNlcjUzNzk1NDk4", + "avatar_url": "https://avatars.githubusercontent.com/u/53795498?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Oviep", + "html_url": "https://github.com/Oviep", + "followers_url": "https://api.github.com/users/Oviep/followers", + "following_url": "https://api.github.com/users/Oviep/following{/other_user}", + "gists_url": "https://api.github.com/users/Oviep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Oviep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Oviep/subscriptions", + "organizations_url": "https://api.github.com/users/Oviep/orgs", + "repos_url": "https://api.github.com/users/Oviep/repos", + "events_url": "https://api.github.com/users/Oviep/events{/privacy}", + "received_events_url": "https://api.github.com/users/Oviep/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "jerrywise97", + "id": 54330961, + "node_id": "MDQ6VXNlcjU0MzMwOTYx", + "avatar_url": "https://avatars.githubusercontent.com/u/54330961?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jerrywise97", + "html_url": "https://github.com/jerrywise97", + "followers_url": "https://api.github.com/users/jerrywise97/followers", + "following_url": "https://api.github.com/users/jerrywise97/following{/other_user}", + "gists_url": "https://api.github.com/users/jerrywise97/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jerrywise97/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jerrywise97/subscriptions", + "organizations_url": "https://api.github.com/users/jerrywise97/orgs", + "repos_url": "https://api.github.com/users/jerrywise97/repos", + "events_url": "https://api.github.com/users/jerrywise97/events{/privacy}", + "received_events_url": "https://api.github.com/users/jerrywise97/received_events", + "type": "User", + "site_admin": False + }, + { + "login": "dayoolacodes", + "id": 54889931, + "node_id": "MDQ6VXNlcjU0ODg5OTMx", + "avatar_url": "https://avatars.githubusercontent.com/u/54889931?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dayoolacodes", + "html_url": "https://github.com/dayoolacodes", + "followers_url": "https://api.github.com/users/dayoolacodes/followers", + "following_url": "https://api.github.com/users/dayoolacodes/following{/other_user}", + "gists_url": "https://api.github.com/users/dayoolacodes/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dayoolacodes/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dayoolacodes/subscriptions", + "organizations_url": "https://api.github.com/users/dayoolacodes/orgs", + "repos_url": "https://api.github.com/users/dayoolacodes/repos", + "events_url": "https://api.github.com/users/dayoolacodes/events{/privacy}", + "received_events_url": "https://api.github.com/users/dayoolacodes/received_events", + "type": "User", + "site_admin": False + } +] + + +def id_is_odd(): + a_list = [] + for dictionary in data: + if dictionary['id'] % 2 != 0: + a_list.append(dictionary['login']) + for i in a_list: + print(i) + + +id_is_odd() + + +def id_has_eight(): + b_list = [] + for dictionary in data: + if str(dictionary['id']).__contains__("8"): + b_list.append(dictionary['login']) + for i in b_list: + print(i) + + +id_has_eight() diff --git a/nine/lekan/functions.py b/nine/lekan/functions.py new file mode 100644 index 0000000..fdd5945 --- /dev/null +++ b/nine/lekan/functions.py @@ -0,0 +1,39 @@ +def factorial(number): + factorials = 1 + for i in range(1, number): + factorials *= i + return factorials + + +print(factorial(6)) + + +def addition(number1, number2): + return number1 + number2 + + +def multiplication(number1, number2): + return number1 * number2 + + +def reverse(number): + reverse_number = 0 + while number != 0: + digit = number % 10 + + reverse_number = reverse_number * 10 + digit + + number = number // 10 + + return reverse_number + + +reverse(23) +print(reverse(23)) + + +def free_flow(a_string=str, an_int=0, a_float=0.0, a_list=None, a_dict={}): + if a_list is None: + a_list = [] + print(a_string) + print(type(a_string)) diff --git a/nine/lekan/json_data.py b/nine/lekan/json_data.py new file mode 100644 index 0000000..ef68709 --- /dev/null +++ b/nine/lekan/json_data.py @@ -0,0 +1,823 @@ +json_data = [ + { + "_id": "61f84b65f0ae2245d60fbbfb", + "index": 0, + "age": 20, + "eyeColor": "brown", + "name": "Ibidapo Olalekan", + "gender": "male", + "email": "ibidapoazeez@gmail.com", + "phone": "+234 (812) 488-4392", + "address": "10 Ajibode Street, Unity Estate", + "friends": [ + { + "id": 0, + "name": "Victor Olaoluwa", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Deji ", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Idris Agbabiaka", + "favorite_food": "Beans" + }, + { + "id": 3, + "name": "Judith", + "favorite_food": "Beans" + }, + { + "id": 4, + "name": "Jacintha", + "favorite_food": "Eba" + } + ], + "favoriteFruit": "peach", + "favoriteGames": "call of duty" + }, + { + "_id": "61f84b65e6bcee50f42fdeae", + "index": 1, + "age": 22, + "eyeColor": "green", + "name": "Jodie Wong", + "gender": "female", + "email": "jodiewong@updat.com", + "phone": "+234 (929) 582-3324", + "address": "381 Ivan Court, Cornfields, Oklahoma, 574", + "friends": [ + { + "id": 0, + "name": "Denise Lott", + "favorite_food": "Beans" + }, + { + "id": 1, + "name": "Gilbert Schmidt", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Murray Eaton", + "favorite_food": "Beans" + }, + { + "id": 3, + "name": "Sharpe Mclaughlin", + "favorite_food": "Milo" + }, + { + "id": 4, + "name": "Ericka Langley", + "favorite_food": "Rice" + } + ], + "favoriteFruit": "guava", + "favoriteGames": "wwe" + }, + { + "_id": "61f84b65891b02a07e65ce1e", + "index": 2, + "age": 31, + "eyeColor": "green", + "name": "Lilia Leblanc", + "gender": "female", + "email": "lilialeblanc@updat.com", + "phone": "+234 (985) 514-3554", + "address": "419 Seabring Street, Kanauga, Missouri, 1721", + "friends": [ + { + "id": 0, + "name": "Oliver Kirkland", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Thornton Stanley", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Alberta Pierce", + "favorite_food": "Milo" + }, + { + "id": 3, + "name": "Ilene Foster", + "favorite_food": "Rice" + }, + { + "id": 4, + "name": "Noreen Beach", + "favorite_food": "Milo" + } + ], + "favoriteFruit": "guava", + "favoriteGames": "Golf" + }, + { + "_id": "61f84b65bac2252aed93f238", + "index": 3, + "age": 27, + "eyeColor": "green", + "name": "Bobbie Lester", + "gender": "female", + "email": "bobbielester@updat.com", + "phone": "+234 (831) 583-2220", + "address": "505 Tompkins Place, Sparkill, Nebraska, 8264", + "friends": [ + { + "id": 0, + "name": "Manning Flowers", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Kellie Benton", + "favorite_food": "Rice" + }, + { + "id": 2, + "name": "Burns Guerra", + "favorite_food": "Beans" + }, + { + "id": 3, + "name": "Hart Sandoval", + "favorite_food": "Beans" + }, + { + "id": 4, + "name": "Katheryn Spence", + "favorite_food": "Beans" + } + ], + "favoriteFruit": "pineapple", + "favoriteGames": "call of duty" + }, + { + "_id": "61f84b6541bd8cbcd6920404", + "index": 4, + "age": 25, + "eyeColor": "green", + "name": "Stout Wilder", + "gender": "male", + "email": "stoutwilder@updat.com", + "phone": "+234 (912) 458-2998", + "address": "999 Cherry Street, Jamestown, Alabama, 2469", + "friends": [ + { + "id": 0, + "name": "Craig Bruce", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Beulah Walker", + "favorite_food": "Rice" + }, + { + "id": 2, + "name": "Rhonda Hull", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Espinoza Carey", + "favorite_food": "Eba" + }, + { + "id": 4, + "name": "Holmes Boyle", + "favorite_food": "Beans" + } + ], + "favoriteFruit": "pineapple", + "favoriteGames": "fifa 19" + }, + { + "_id": "61f84b65fcc713d694c759aa", + "index": 5, + "age": 39, + "eyeColor": "blue", + "name": "Josefina Malone", + "gender": "female", + "email": "josefinamalone@updat.com", + "phone": "+234 (917) 526-2864", + "address": "438 Bouck Court, Forbestown, Virgin Islands, 3693", + "friends": [ + { + "id": 0, + "name": "Olga Oneal", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Buckner Murray", + "favorite_food": "Eba" + }, + { + "id": 2, + "name": "Dee Ferguson", + "favorite_food": "Beans" + }, + { + "id": 3, + "name": "April Bradshaw", + "favorite_food": "Milo" + }, + { + "id": 4, + "name": "Marva Roach", + "favorite_food": "Milo" + } + ], + "favoriteFruit": "apple", + "favoriteGames": "call of duty" + }, + { + "_id": "61f84b65b91844655320c2e1", + "index": 6, + "age": 28, + "eyeColor": "green", + "name": "Hardin Simpson", + "gender": "male", + "email": "hardinsimpson@updat.com", + "phone": "+234 (800) 557-3322", + "address": "572 Catherine Street, Kingstowne, Florida, 8782", + "friends": [ + { + "id": 0, + "name": "Mercer Christensen", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Madelyn Farrell", + "favorite_food": "Beans" + }, + { + "id": 2, + "name": "Bryant May", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Graves Hopkins", + "favorite_food": "Milo" + }, + { + "id": 4, + "name": "Diana Diaz", + "favorite_food": "Rice" + } + ], + "favoriteFruit": "peach", + "favoriteGames": "call of duty" + }, + { + "_id": "61f84b658d149ea88ac5818a", + "index": 7, + "age": 31, + "eyeColor": "green", + "name": "Bridget Gilbert", + "gender": "female", + "email": "bridgetgilbert@updat.com", + "phone": "+234 (882) 568-3184", + "address": "893 Howard Alley, Dale, Nevada, 6860", + "friends": [ + { + "id": 0, + "name": "Pollard Peters", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Levine Spencer", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Terrell Newton", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Banks Winters", + "favorite_food": "Eba" + }, + { + "id": 4, + "name": "Jenkins Watts", + "favorite_food": "Rice" + } + ], + "favoriteFruit": "guava", + "favoriteGames": "call of duty" + }, + { + "_id": "61f84b65aeae4d41bfa184e8", + "index": 8, + "age": 28, + "eyeColor": "green", + "name": "Velazquez Dunlap", + "gender": "male", + "email": "velazquezdunlap@updat.com", + "phone": "+234 (943) 426-2614", + "address": "694 Barbey Street, Canterwood, Oregon, 7079", + "friends": [ + { + "id": 0, + "name": "Alexandria Stark", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Socorro Bonner", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Hyde Lamb", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Jefferson Guzman", + "favorite_food": "Milo" + }, + { + "id": 4, + "name": "Short Taylor", + "favorite_food": "Beans" + } + ], + "favoriteFruit": "guava", + "favoriteGames": "wwe" + }, + { + "_id": "61f84b651f1155e61737a8e0", + "index": 9, + "age": 34, + "eyeColor": "green", + "name": "Knapp Delacruz", + "gender": "male", + "email": "knappdelacruz@updat.com", + "phone": "+234 (849) 447-2309", + "address": "898 Cozine Avenue, Foscoe, New York, 318", + "friends": [ + { + "id": 0, + "name": "Shelley Hardin", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Mcguire Copeland", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Grimes Weiss", + "favorite_food": "Rice" + }, + { + "id": 3, + "name": "Alyssa Zimmerman", + "favorite_food": "Beans" + }, + { + "id": 4, + "name": "Sims Boyd", + "favorite_food": "Eba" + } + ], + "favoriteFruit": "guava", + "favoriteGames": "fifa 19" + }, + { + "_id": "61f84b65b68a15786e041cc8", + "index": 10, + "age": 29, + "eyeColor": "brown", + "name": "Clare Mcfarland", + "gender": "female", + "email": "claremcfarland@updat.com", + "phone": "+234 (811) 514-2636", + "address": "947 Orange Street, Hackneyville, Alaska, 5491", + "friends": [ + { + "id": 0, + "name": "Beverley Carroll", + "favorite_food": "Rice" + }, + { + "id": 1, + "name": "Norris Mckenzie", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Marshall Lewis", + "favorite_food": "Rice" + }, + { + "id": 3, + "name": "Petty Ellison", + "favorite_food": "Eba" + }, + { + "id": 4, + "name": "Harriett Mooney", + "favorite_food": "Rice" + } + ], + "favoriteFruit": "strawberry", + "favoriteGames": "wwe" + }, + { + "_id": "61f84b652d899090b725c8d0", + "index": 11, + "age": 28, + "eyeColor": "blue", + "name": "Klein Patrick", + "gender": "male", + "email": "kleinpatrick@updat.com", + "phone": "+234 (921) 509-2440", + "address": "270 Malbone Street, Chalfant, New Jersey, 1622", + "friends": [ + { + "id": 0, + "name": "Keri Rodriguez", + "favorite_food": "Rice" + }, + { + "id": 1, + "name": "Sallie Clark", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Joanne Durham", + "favorite_food": "Milo" + }, + { + "id": 3, + "name": "Opal Morris", + "favorite_food": "Rice" + }, + { + "id": 4, + "name": "Miranda Knight", + "favorite_food": "Beans" + } + ], + "favoriteFruit": "banana", + "favoriteGames": "fifa 19" + }, + { + "_id": "61f84b6544106e33528dc474", + "index": 12, + "age": 29, + "eyeColor": "blue", + "name": "Farley Bird", + "gender": "male", + "email": "farleybird@updat.com", + "phone": "+234 (970) 598-2804", + "address": "111 Abbey Court, Westboro, Arizona, 7266", + "friends": [ + { + "id": 0, + "name": "Hampton Bates", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Mitchell Spears", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Lorraine Schneider", + "favorite_food": "Milo" + }, + { + "id": 3, + "name": "Daphne Lambert", + "favorite_food": "Beans" + }, + { + "id": 4, + "name": "Joyner Sears", + "favorite_food": "Milo" + } + ], + "favoriteFruit": "guava", + "favoriteGames": "Golf" + }, + { + "_id": "61f84b65f58902ecaef9c87e", + "index": 13, + "age": 22, + "eyeColor": "brown", + "name": "Margret Sanford", + "gender": "female", + "email": "margretsanford@updat.com", + "phone": "+234 (894) 568-2397", + "address": "524 Chase Court, Brewster, New Hampshire, 3527", + "friends": [ + { + "id": 0, + "name": "Elinor Salinas", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Sullivan Estrada", + "favorite_food": "Beans" + }, + { + "id": 2, + "name": "Johanna Thomas", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Vivian Pollard", + "favorite_food": "Beans" + }, + { + "id": 4, + "name": "Frost Watkins", + "favorite_food": "Beans" + } + ], + "favoriteFruit": "peach", + "favoriteGames": "Golf" + }, + { + "_id": "61f84b6549648c3d17140734", + "index": 14, + "age": 33, + "eyeColor": "blue", + "name": "Stella Goff", + "gender": "female", + "email": "stellagoff@updat.com", + "phone": "+234 (881) 561-2374", + "address": "115 Schenck Court, Berwind, Pennsylvania, 8802", + "friends": [ + { + "id": 0, + "name": "Mcbride Franco", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Landry Mccray", + "favorite_food": "Eba" + }, + { + "id": 2, + "name": "Tia Dudley", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Duffy Short", + "favorite_food": "Rice" + }, + { + "id": 4, + "name": "Leila Robbins", + "favorite_food": "Beans" + } + ], + "favoriteFruit": "peach", + "favoriteGames": "Golf" + }, + { + "_id": "61f84b65bf4ef144697eda56", + "index": 15, + "age": 27, + "eyeColor": "green", + "name": "Shelby Johnston", + "gender": "female", + "email": "shelbyjohnston@updat.com", + "phone": "+234 (883) 590-3819", + "address": "680 Cove Lane, Osmond, Colorado, 8805", + "friends": [ + { + "id": 0, + "name": "Bryan Cantu", + "favorite_food": "Beans" + }, + { + "id": 1, + "name": "Moore Albert", + "favorite_food": "Rice" + }, + { + "id": 2, + "name": "Fitzpatrick Duncan", + "favorite_food": "Beans" + }, + { + "id": 3, + "name": "Georgina Daniels", + "favorite_food": "Beans" + }, + { + "id": 4, + "name": "May Delgado", + "favorite_food": "Eba" + } + ], + "favoriteFruit": "strawberry", + "favoriteGames": "wwe" + }, + { + "_id": "61f84b65134d2236ae0e8c1d", + "index": 16, + "age": 34, + "eyeColor": "blue", + "name": "Cabrera Pratt", + "gender": "male", + "email": "cabrerapratt@updat.com", + "phone": "+234 (836) 477-2059", + "address": "519 Homecrest Avenue, Remington, Connecticut, 5734", + "friends": [ + { + "id": 0, + "name": "Cooley Burt", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Jenny Rutledge", + "favorite_food": "Eba" + }, + { + "id": 2, + "name": "Elva Douglas", + "favorite_food": "Milo" + }, + { + "id": 3, + "name": "Juana Farley", + "favorite_food": "Rice" + }, + { + "id": 4, + "name": "Barnett Garner", + "favorite_food": "Eba" + } + ], + "favoriteFruit": "strawberry", + "favoriteGames": "Golf" + }, + { + "_id": "61f84b6595b3b20dc930bef3", + "index": 17, + "age": 35, + "eyeColor": "green", + "name": "Peterson Mack", + "gender": "male", + "email": "petersonmack@updat.com", + "phone": "+234 (838) 566-3355", + "address": "453 Livingston Street, Singer, Massachusetts, 3221", + "friends": [ + { + "id": 0, + "name": "Nora Montoya", + "favorite_food": "Milo" + }, + { + "id": 1, + "name": "Mcclure Stephenson", + "favorite_food": "Milo" + }, + { + "id": 2, + "name": "Booker Luna", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Molly Rowe", + "favorite_food": "Eba" + }, + { + "id": 4, + "name": "Meredith Sharpe", + "favorite_food": "Eba" + } + ], + "favoriteFruit": "pineapple", + "favoriteGames": "call of duty" + }, + { + "_id": "61f84b65afaa3f035c2cb4b6", + "index": 18, + "age": 30, + "eyeColor": "brown", + "name": "Kitty Ramos", + "gender": "female", + "email": "kittyramos@updat.com", + "phone": "+234 (933) 442-3041", + "address": "655 Newton Street, Lowell, Maryland, 1212", + "friends": [ + { + "id": 0, + "name": "Mcconnell Merrill", + "favorite_food": "Eba" + }, + { + "id": 1, + "name": "Lena Moore", + "favorite_food": "Rice" + }, + { + "id": 2, + "name": "Battle Howard", + "favorite_food": "Eba" + }, + { + "id": 3, + "name": "Craft Woodard", + "favorite_food": "Milo" + }, + { + "id": 4, + "name": "Stark Wells", + "favorite_food": "Rice" + } + ], + "favoriteFruit": "pineapple", + "favoriteGames": "wwe" + }, + { + "_id": "61f84b65836d41f3ca67392a", + "index": 19, + "age": 29, + "eyeColor": "blue", + "name": "Graciela Henson", + "gender": "female", + "email": "gracielahenson@updat.com", + "phone": "+234 (801) 499-3826", + "address": "896 Maujer Street, Newry, Illinois, 7862", + "friends": [ + { + "id": 0, + "name": "Taylor Jenkins", + "favorite_food": "Beans" + }, + { + "id": 1, + "name": "Paula Noel", + "favorite_food": "Eba" + }, + { + "id": 2, + "name": "Hall Duffy", + "favorite_food": "Beans" + }, + { + "id": 3, + "name": "Logan Gross", + "favorite_food": "Milo" + }, + { + "id": 4, + "name": "Emerson Weaver", + "favorite_food": "Eba" + } + ], + "favoriteFruit": "apple", + "favoriteGames": "Golf" + } +] + +print(json_data) +print(json_data[0]['friends'][0]['favorite_food']) +name = json_data[1]['friends'][2]['name'] +id = json_data[1]['friends'][2]['id'] + +print(name, 'with identity of ', id) + + +def addition(number1, number2): + return number1 + number2 + + +def addition(number1, number2, number3): + return number1 + number2 + number3 + + +number1 = 23 +number2 = 24 +number3 = 12 +print(addition(number1, number2, number3)) diff --git a/nine/lekan/main.py b/nine/lekan/main.py index e3ee127..0bbb334 100644 --- a/nine/lekan/main.py +++ b/nine/lekan/main.py @@ -1,2 +1,6 @@ + name = "Lekan Ibidapo" -print("My name is", name) \ No newline at end of file +print("My name is", name) + +hidden = list(input()) +print(len(hidden)) diff --git a/nine/lekan/plus_minus.py b/nine/lekan/plus_minus.py new file mode 100644 index 0000000..139d2b2 --- /dev/null +++ b/nine/lekan/plus_minus.py @@ -0,0 +1,21 @@ +arr = [1, 1, 0, -1, -1] + + +def plus_minus(arr): + count = 0 + negative_count = 0 + zero = 0 + for i in range(len(arr)): + if arr[i] > 0: + count += 1 + elif arr[i] < 0: + negative_count += 1 + elif arr[i] == 0: + zero += 1 + + print(f'{count / len(arr):.6f}') + print(f'{negative_count / len(arr):6f}') + print(f'{zero / len(arr):6f}') + + +plus_minus(arr) diff --git a/nine/lekan/practice_code/maximum_value.py b/nine/lekan/practice_code/maximum_value.py new file mode 100644 index 0000000..8ef5c92 --- /dev/null +++ b/nine/lekan/practice_code/maximum_value.py @@ -0,0 +1,19 @@ +def maximum(value1, value2, value3): + max_value = value1 + if value2 > max_value: + max_value = value2 + if value3 > max_value: + max_value = value3 + + return max_value + + +def main(): + value1 = 23 + value2 = 45 + value3 = 20 + max_value = maximum(value1, value2, value3) + print('The maximum value is ', max_value) + + +main() diff --git a/nine/lekan/practice_code/minimum_maximum.py b/nine/lekan/practice_code/minimum_maximum.py new file mode 100644 index 0000000..afce028 --- /dev/null +++ b/nine/lekan/practice_code/minimum_maximum.py @@ -0,0 +1,14 @@ +import sys + + +def max_min(arr): + max = -sys.maxsize - 1 + min = sys.maxsize + sum = 0 + for x in range(len(arr)): + sum += x + if x > max: + max = x + if x < min: + min = x + print(sum - max, sum - min) diff --git a/nine/lekan/practice_code/rolling_dice.py b/nine/lekan/practice_code/rolling_dice.py new file mode 100644 index 0000000..86e7f35 --- /dev/null +++ b/nine/lekan/practice_code/rolling_dice.py @@ -0,0 +1,31 @@ +import random + +frequency1 = 0 +frequency2 = 0 +frequency3 = 0 +frequency4 = 0 +frequency5 = 0 +frequency6 = 0 + +for r in range(6000000): + face = random.randrange(1, 7) + if face == 1: + frequency1 += 1 + elif face == 2: + frequency2 += 1 + elif face == 3: + frequency3 += 1 + elif face == 4: + frequency4 += 1 + elif face == 5: + frequency5 += 1 + elif face == 6: + frequency6 += 1 + +print(f'Face{"Frequency":>13}') +print(f'{1:> 4}{frequency1 :> 13}') +print(f'{2 :> 4}{frequency2 :> 13}') +print(f'{3 :> 4}{frequency3 :> 13}') +print(f'{4 :> 4}{frequency4 :>13}') +print(f'{5 :> 4} {frequency5 :> 13}') +print(f'{6 :> 4}{frequency6 :> 13}') diff --git a/nine/lekan/tic_tac_toe.py b/nine/lekan/practice_code/tic_tac_toe.py similarity index 61% rename from nine/lekan/tic_tac_toe.py rename to nine/lekan/practice_code/tic_tac_toe.py index 18b530a..d04db77 100644 --- a/nine/lekan/tic_tac_toe.py +++ b/nine/lekan/practice_code/tic_tac_toe.py @@ -1,4 +1,4 @@ -variable = [['X', 'O', 'O'], ['X', 'X', 'X'], ['O', 'X', ' O']] +variable = [['X', 'O', 'O'], ['O', 'X', 'X'], ['O', 'X', ' X']] for i in range(3): for j in range(3): diff --git a/nine/lekan/practice_code/world_clock.py b/nine/lekan/practice_code/world_clock.py new file mode 100644 index 0000000..f995128 --- /dev/null +++ b/nine/lekan/practice_code/world_clock.py @@ -0,0 +1,35 @@ +import datetime + + +def print_time(hours, minutes, seconds): + return hours, ':', minutes, ":", seconds + + +while True: + city = input("Enter the city: ") + + current_time = datetime.datetime.now(); + hour = current_time.hour + minute = current_time.minute + second = current_time.second + + if city == 'Boston': + hour = hour - 4 + print_time(hour, minute, second) + elif city == 'Tokyo': + hour = hour + 9 + print_time(hour, minute, second) + elif city == 'Chicago': + hour = hour - 5 + print_time(hour, minute, second) + elif city == 'Seattle': + hour = hour - 7 + print_time(hour, minute, second) + elif city == 'Kolkota': + hour = hour + 5 + minutes = minute + 30 + print_time(hour, minutes, second) + elif city == 'Cairo': + hour = hour + 2 + print_time(hour, minute, second) + diff --git a/nine/lekan/ten_ten.py b/nine/lekan/ten_ten.py index a94bec8..e860171 100644 --- a/nine/lekan/ten_ten.py +++ b/nine/lekan/ten_ten.py @@ -1,16 +1,24 @@ -player_one_score = 0 -player_two_score = 0 +def ten_ten(): + player_one_score = 0 + player_two_score = 0 -for i in range(5): - play_one = input("Enter a value: ") - play_two = input("Enter a value: ") + for i in range(5): + play_one = input("Enter a value: ") + play_two = input("Enter a value: ") - if play_one == play_two: - print("winner is leg two") - player_two_score += 1 - elif play_one != play_two: - print("Thw winner is leg one") - player_one_score += 1 + is_user_play_different = play_one != play_two + is_play_equal = play_one == play_two + if is_play_equal: + print("winner is leg two") + player_two_score += 1 + elif is_user_play_different: + print("Thw winner is leg one") + player_one_score += 1 -print("Leg one score is ", player_one_score) -print("Leg two score is ", player_two_score) + print("Leg one score is ", player_one_score) + print("Leg two score is ", player_two_score) + + +def tired_class(): + print('We are tired!!!!') + print("Let us go on break!!!!!") diff --git a/nine/lekan/tuesday_before.py b/nine/lekan/tuesday_before.py new file mode 100644 index 0000000..a4d103c --- /dev/null +++ b/nine/lekan/tuesday_before.py @@ -0,0 +1,238 @@ +from xmlrpc.client import boolean + +data = {"colors": [ + { + "color": "red", + "value": "#f00" + }, + { + "color": "green", + "value": "#0f0" + }, + { + "color": "blue", + "value": "#00f" + }, + { + "color": "cyan", + "value": "#0ff" + }, + { + "color": "magenta", + "value": "#f0f" + }, + { + "color": "yellow", + "value": "#ff0" + }, + { + "color": "black", + "value": "#000" + } +], + + "example_one": { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + {"id": "1001", "type": "Regular"}, + {"id": "1002", "type": "Chocolate"}, + {"id": "1003", "type": "Blueberry"}, + {"id": "1004", "type": "Devil's Food"} + ] + }, + "topping": + [ + {"id": "5001", "type": "None"}, + {"id": "5002", "type": "Glazed"}, + {"id": "5005", "type": "Sugar"}, + {"id": "5007", "type": "Powdered Sugar"}, + {"id": "5006", "type": "Chocolate with Sprinkles"}, + {"id": "5003", "type": "Chocolate"}, + {"id": "5004", "type": "Maple"}, + ] + }, + "example_two": [ + { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + {"id": "1001", "type": "Regular"}, + {"id": "1002", "type": "Chocolate"}, + {"id": "1003", "type": "Blueberry"}, + {"id": "1004", "type": "Devil's Food"} + ] + }, + "topping": + [ + {"id": "5001", "type": "None"}, + {"id": "5002", "type": "Glazed"}, + {"id": "5005", "type": "Sugar"}, + {"id": "5007", "type": "Powdered Sugar"}, + {"id": "5006", "type": "Chocolate with Sprinkles"}, + {"id": "5003", "type": "Chocolate"}, + {"id": "5004", "type": "Maple"} + ] + }, + { + "id": "0002", + "type": "donut", + "name": "Raised", + "ppu": 0.55, + "batters": + { + "batter": + [ + {"id": "1001", "type": "Regular"} + ] + }, + "topping": + [ + {"id": "5001", "type": "None"}, + {"id": "5002", "type": "Glazed"}, + {"id": "5005", "type": "Sugar"}, + {"id": "5003", "type": "Chocolate"}, + {"id": "5004", "type": "Maple"} + ] + }, + { + "id": "0003", + "type": "donut", + "name": "Old Fashioned", + "ppu": 0.55, + "batters": + { + "batter": + [ + {"id": "1001", "type": "Regular"}, + {"id": "1002", "type": "Chocolate"} + ] + }, + "topping": + [ + {"id": "5001", "type": "None"}, + {"id": "5002", "type": "Glazed"}, + {"id": "5003", "type": "Chocolate"}, + {"id": "5004", "type": "Maple"} + ] + } + ], + + "example_three": { + "id": "0001", + "type": "donut", + "name": "Cake", + "image": + { + "url": "images/0001.jpg", + "width": 200, + "height": 200 + }, + "thumbnail": + { + "url": "images/thumbnails/0001.jpg", + "width": 32, + "height": 32 + } + }, + + "example_four": { + "items": + { + "item": + [ + { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + {"id": "1001", "type": "Regular"}, + {"id": "1002", "type": "Chocolate"}, + {"id": "1003", "type": "Blueberry"}, + {"id": "1004", "type": "Devil's Food"} + ] + }, + "topping": + [ + {"id": "5001", "type": "None"}, + {"id": "5002", "type": "Glazed"}, + {"id": "5005", "type": "Sugar"}, + {"id": "5007", "type": "Powdered Sugar"}, + {"id": "5006", "type": "Chocolate with Sprinkles"}, + {"id": "5003", "type": "Chocolate"}, + {"id": "5004", "type": "Maple"} + ] + } + + ] + } + } +} + + +def get_f(): + print("The colours with #f are :") + for i in range(len(data["colors"])): + if data["colors"][i]["value"].__contains__("#f"): + print(data['colors'][i]['color']) + + +def check_for_maple(): + for i in range(len(data["topping"])): + if data["example_one"]["topping"][i]["type"].__contains__("Maple"): + print("The Id of the maple is", data["example_one"]["topping"][i]["id"]) + + +def check_for_batters_in_old_fashioned_donuts(): + for i in range(len(data["example_two"])): + if data["example_two"][i]["name"].__contains__("Old Fashioned"): + for x in range(2): + print(data["example_two"][i]["batters"]["batter"][x]["type"]) + + +def check_for_all_toppings(): + print("Type \t\t\t\t\t", "\t\t\t ID") + for i in range(len(data["example_four"])): + if data["example_four"]["items"]["item"][i]["topping"]: + for k in range(len(data["example_four"]["items"]["item"][i]["topping"])): + print(data["example_four"]["items"]["item"][i]["topping"][k]["type"], "\t \t", data["example_four"]["items"]["item"][i]["topping"][k]["id"]) + + +def check_for_all_thumbnail(): + for i in range(len(data["example_three"])): + if data["example_three"]["thumbnail"]: + print(data["example_three"]["thumbnail"]) + + + +# +# get_f() +# print() +# check_for_maple() +# print() +# check_for_batters_in_old_fashioned_donuts() +# print() +# check_for_all_toppings() +# print() +check_for_all_thumbnail() + +a_str = 'hello' +a_str[1] = 'r' +print(a_str) + + +