From 20f708d45f1eb4d19f003ec673e25ee706daef09 Mon Sep 17 00:00:00 2001 From: Luka Jasovic Date: Tue, 10 Sep 2024 12:12:15 +0200 Subject: [PATCH 1/4] Add files via upload --- main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..8f368da --- /dev/null +++ b/main.py @@ -0,0 +1,14 @@ +class Website: + def __init__(self, url, founding_year, free_to_use): + self.url = url + self.founding_year = founding_year + self.free_to_use = free_to_use + +def website_info(website): + print("URL:", website.url) + print("Founding year:", website.founding_year) + print("Free to use:", website.free_to_use) + +GitHub = Website("https://github.com", 2008, True) + +website_info(GitHub) From 329edf032f4837c9c8580d0b521e0a1d5408241f Mon Sep 17 00:00:00 2001 From: Luka Jasovic Date: Tue, 10 Sep 2024 13:50:40 +0200 Subject: [PATCH 2/4] Add files via upload --- basic2.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 basic2.py diff --git a/basic2.py b/basic2.py new file mode 100644 index 0000000..855e439 --- /dev/null +++ b/basic2.py @@ -0,0 +1,14 @@ +def yes_no(question): + while True: + x = input(question + "Answer Yes/No only.").strip() + if x == "Yes": + return True + elif x == "No": + return False + else: + print("Please only type Yes/No.") + +if yes_no("Do you like ice cream?"): + print("like") +else: + print("don't like") \ No newline at end of file From b3952b429ef14e9c20377198140403e05fab0681 Mon Sep 17 00:00:00 2001 From: Luka Jasovic Date: Sat, 14 Sep 2024 14:45:50 +0200 Subject: [PATCH 3/4] Add files via upload Basic guessing game --- Number guessing game.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Number guessing game.py diff --git a/Number guessing game.py b/Number guessing game.py new file mode 100644 index 0000000..a137ac3 --- /dev/null +++ b/Number guessing game.py @@ -0,0 +1,27 @@ +import random +def print_box(text): + print(len(text)*'*') + print(text) + print(len(text)*'*') +print_box("This is a game :)") + + +mm_count = random.randint(1,100) +attempt_limit = 3 +attempts = 0 + +while attempts < attempt_limit: + guess_number = input("How many M&M's are left?") + attempts +=1 + guess = int(guess_number) + if mm_count == guess_number: + print(f"Good Job! You guessed correct! It is {guess_number}") + break + + elif guess < mm_count: + print("Sorry that is too low number") + elif guess > mm_count: + print ("Sorry that is too high") + + + From 346f44326ccd4cbb9eb3453ac50583515d83deca Mon Sep 17 00:00:00 2001 From: Luka Jasovic Date: Sat, 14 Sep 2024 17:05:30 +0200 Subject: [PATCH 4/4] Add files via upload basic password generator of desired lenght using for nested loop --- password-generator.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 password-generator.py diff --git a/password-generator.py b/password-generator.py new file mode 100644 index 0000000..174661a --- /dev/null +++ b/password-generator.py @@ -0,0 +1,17 @@ +#password generator 1) number of chars +#2) lenght + +import random + +characters = "sadpkoj231eo123sadsdik1-20ekaspocasz//12!" +number = input('Number of passwords: ') +number = int(number) +lenght = input("Input your password lenght: ") +lenght = int(lenght) +print ("\nHere are your passwords: ") +for pwd in range(number): + passwords = '' + for c in range(lenght): + passwords += random.choice(characters) + + print(passwords) \ No newline at end of file