diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..ac21435
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..812ab5a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..fc4741d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workshop.iml b/.idea/workshop.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/.idea/workshop.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1] guessing game/main.py b/1] guessing game/main.py
index e69de29..3ab93b9 100644
--- a/1] guessing game/main.py
+++ b/1] guessing game/main.py
@@ -0,0 +1,30 @@
+import random
+
+def guess_the_number():
+
+ number_to_guess = random.randint(1, 100)
+
+ while True:
+
+ user_input = input("Guess the number: ")
+
+ try:
+ guess = int(user_input)
+ except ValueError:
+ print("It's not a number!")
+ continue
+
+
+ if guess < number_to_guess:
+ print("Too small!")
+ elif guess > number_to_guess:
+ print("Too big!")
+ else:
+ print("You win!")
+ break
+
+
+guess_the_number()
+print("Thanks for playing!")
+
+
diff --git a/2] loto/main.py b/2] loto/main.py
index e69de29..53f5dad 100644
--- a/2] loto/main.py
+++ b/2] loto/main.py
@@ -0,0 +1,45 @@
+import random
+
+
+def get_user_numbers():
+ user_numbers = set()
+ while len(user_numbers) < 6:
+ try:
+ user_input = input("Enter a number (1-49): ")
+ number = int(user_input)
+ if number < 1 or number > 49:
+ print("Number must be between 1 and 49.")
+ elif number in user_numbers:
+ print("You have already entered this number.")
+ else:
+ user_numbers.add(number)
+ except ValueError:
+ print("That's not a valid number.")
+ return sorted(user_numbers)
+
+
+def draw_lotto_numbers():
+ return sorted(random.sample(range(1, 50), 6))
+
+
+def compare_numbers(user_numbers, lotto_numbers):
+ return len(set(user_numbers).intersection(set(lotto_numbers)))
+
+
+def main():
+ print("Welcome to the LOTTO Simulator!")
+ user_numbers = get_user_numbers()
+ print("\nYour numbers: ", user_numbers)
+
+ lotto_numbers = draw_lotto_numbers()
+ print("LOTTO draw: ", lotto_numbers)
+
+ matches = compare_numbers(user_numbers, lotto_numbers)
+ if matches >= 3:
+ print(f"Congratulations! You have matched {matches} number(s).")
+ else:
+ print("Unfortunately, you did not match enough numbers to win a prize.")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/3] guessing game 2/main.py b/3] guessing game 2/main.py
index e69de29..20f09e3 100644
--- a/3] guessing game 2/main.py
+++ b/3] guessing game 2/main.py
@@ -0,0 +1,36 @@
+def computer_guess():
+ print("Think of a number between 1 and 1000 and I'll guess it in no more than 10 moves.")
+ print("Respond with 'Too small', 'Too big', or 'You win' after each of my guesses.")
+
+ low = 1
+ high = 1000
+ guess = (low + high) // 2
+ feedback = ''
+ attempts = 0
+
+ while feedback != 'You win' and attempts < 10:
+ attempts += 1
+ print(f"My guess is: {guess}.")
+ feedback = input("Feedback: ").strip()
+
+ if feedback == 'Too small':
+ low = guess + 1
+ elif feedback == 'Too big':
+ high = guess - 1
+ elif feedback == 'You win':
+ print("Hooray! I guessed!") # Updated message
+ break
+ else:
+ print("Please enter a valid response ('Too small', 'Too big', 'You win').")
+ attempts -= 1 # Invalid feedback doesn't count as an attempt
+
+ guess = (low + high) // 2
+
+ if feedback != 'You win':
+ print("Seems like we've reached the max attempts or something went wrong. Did you cheat? 😉")
+
+
+if __name__ == "__main__":
+ computer_guess()
+
+
diff --git a/4] guessing game 3/main.py b/4] guessing game 3/main.py
index e69de29..253b523 100644
--- a/4] guessing game 3/main.py
+++ b/4] guessing game 3/main.py
@@ -0,0 +1,52 @@
+from flask import Flask, request
+
+app = Flask(__name__)
+
+HTML = '''
+
+
+
+
+ Guess My Number
+
+
+ Is your number {{ guess }}?
+
+
+
+'''
+
+
+@app.route('/', methods=['GET', 'POST'])
+def guess():
+ if request.method == 'POST':
+ min_val = int(request.form.get('min', 1))
+ max_val = int(request.form.get('max', 1000))
+ guess = int(request.form.get('guess', 500))
+ answer = request.form['answer']
+
+ if answer == 'too_small':
+ min_val = guess + 1
+ elif answer == 'too_big':
+ max_val = guess - 1
+ elif answer == 'correct':
+ return 'Congratulations! I guessed your number.'
+
+ guess = (min_val + max_val) // 2
+ else:
+ min_val = 1
+ max_val = 1000
+ guess = (min_val + max_val) // 2
+
+ return render_template_string(HTML, min=min_val, max=max_val, guess=guess)
+
+
+if __name__ == '__main__':
+ app.run(debug=True)
diff --git a/5] 2001/main.py b/5] 2001/main.py
index e69de29..6020048 100644
--- a/5] 2001/main.py
+++ b/5] 2001/main.py
@@ -0,0 +1,47 @@
+from roll_the_dice import roll_the_dice
+
+def calculate_points(points):
+ """Calculate points.
+
+ :param int points:
+
+ :rtype: int
+ :return: new_points
+ """
+ roll = roll_the_dice("2D6")
+ if roll == 7:
+ points //= 7
+ elif roll == 11:
+ points *= 11
+ else:
+ points += roll
+ return points
+
+
+def game_2001():
+ """2001 game."""
+ user_points = 0
+ computer_points = 0
+
+ input("Press ENTER to roll the dice")
+ user_points += roll_the_dice("2D6")
+ computer_points += roll_the_dice("2D6")
+
+ while user_points < 2001 and computer_points < 2001:
+ print(f"User points: {user_points}\nComputer points: {computer_points}")
+ input("Press ENTER to roll the dice")
+ user_points = calculate_points(user_points)
+ computer_points = calculate_points(computer_points)
+
+ print(f"User points: {user_points}\n Computer points: {computer_points}")
+ if computer_points > user_points:
+ print("Computer wins!")
+ elif user_points > computer_points:
+ print("User wins!")
+ else:
+ print("Draw")
+
+
+if __name__ == '__main__':
+ game_2001()
+
diff --git a/5] dice/main.py b/5] dice/main.py
index e69de29..59d79cc 100644
--- a/5] dice/main.py
+++ b/5] dice/main.py
@@ -0,0 +1,84 @@
+import random
+
+POSSIBLE_DICE = (
+
+ "D100",
+
+ "D20",
+
+ "D12",
+
+ "D10",
+
+ "D8",
+
+ "D6",
+
+ "D4",
+
+ "D3"
+
+)
+def roll_the_dice(dice_code):
+ """
+
+ Calculate dice roll from dice pattern.
+
+
+
+ :param str dice_code: dice pattern ex. `7D12-5`
+
+
+
+ :rtype: int, str
+
+ :return: dice roll value for proper dice pattern, `Wrong Input` text elsewhere
+
+ """
+
+ for dice in POSSIBLE_DICE:
+
+ if dice in dice_code:
+
+ try:
+
+ multiply, modifier = dice_code.split(dice)
+
+ except ValueError:
+
+ return "Wrong Input"
+
+ dice_value = int(dice[1:])
+
+ break
+
+ else:
+
+ return "Wrong Input"
+
+ try:
+
+ multiply = int(multiply) if multiply else 1
+
+ except ValueError:
+
+ return "Wrong Input"
+
+ try:
+
+ modifier = int(modifier) if modifier else 0
+
+ except ValueError:
+
+ return "Wrong Input"
+
+ return sum([random.randint(1, dice_value) for _ in range(multiply)]) + modifier
+
+
+if __name__ == '__main__':
+ print(roll_the_dice("2D10+10"))
+ print(roll_the_dice("D6"))
+ print(roll_the_dice("2D3"))
+ print(roll_the_dice("D12-1"))
+ print(roll_the_dice("DD34"))
+ print(roll_the_dice("4-3D6"))
\ No newline at end of file