Skip to content
Open

a #57

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
40 changes: 40 additions & 0 deletions Calculator
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
def add(x, y):
"""Addition"""
return x + y

def subtract(x, y):
"""Subtraction"""
return x - y

def multiply(x, y):
"""multiplication"""
return x * y

def divide(x, y):
"""Division"""
if y != 0:
return x / y
else:
return "Error, divide -0-!"

print("Choose transaction:")
print("1. Addition")
print("2. Subtraction")
print("3. multiplication")
print("4. Division")

choice = input("Add number operation (1/2/3/4): ")

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))

if choice == '1':
print(num1, "+", num2, "=", add(num1, num2))
elif choice == '2':
print(num1, "-", num2, "=", subtract(num1, num2))
elif choice == '3':
print(num1, "*", num2, "=", multiply(num1, num2))
elif choice == '4':
print(num1, "/", num2, "=", divide(num1, num2))
else:
print("Incorrect input transaction")
31 changes: 31 additions & 0 deletions Password Generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import random
import string

def generate_password(length):
# Define character sets for password generation
uppercase_letters = string.ascii_uppercase
lowercase_letters = string.ascii_lowercase
numbers = string.digits
special_characters = string.punctuation

# Ensure the generated password meets the required criteria
while True:
password = random.choices(uppercase_letters, k=1) + \
random.choices(lowercase_letters, k=1) + \
random.choices(numbers, k=1) + \
random.choices(special_characters, k=1) + \
random.choices(uppercase_letters + lowercase_letters + numbers + special_characters, k=length-4)
password = ''.join(password)
if (any(char.isupper() for char in password) and
any(char.islower() for char in password) and
any(char.isdigit() for char in password) and
any(char in special_characters for char in password)):
break

return password

print("Welcome to the Linux User Password Generator!")
length = int(input("Please enter the desired password length: "))

password = generate_password(length)
print("\nGenerated password:", password)
4 changes: 3 additions & 1 deletion students.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
First Name Last Name
Artem Hrechanychenko
Artem Hrechanychenko

Andrii Vyshnevskyi