diff --git a/Task1.py b/Task1.py new file mode 100644 index 0000000..e76fdf3 --- /dev/null +++ b/Task1.py @@ -0,0 +1,6 @@ +name = input("Enter your name: ") +surname = input("Enter your surname: ") +otchestvo = input("Enter name by father: ") + +full_name = surname + ' ' + name[0].upper() + '.' + otchestvo[0].upper() + '.' +print(full_name) \ No newline at end of file diff --git a/Task10.py b/Task10.py new file mode 100644 index 0000000..973876b --- /dev/null +++ b/Task10.py @@ -0,0 +1,9 @@ +a = int(input("Enter a: ")) +b = int(input("Enter b: ")) + +print("a + b =", a + b, + "\na - b =", a - b, + "\na * b =", a * b, + "\na / b =", a / b, + "\nremainder a from b =", a % b, + "\na to the power of b =", a ** b) \ No newline at end of file diff --git a/Task11.py b/Task11.py new file mode 100644 index 0000000..7974c34 --- /dev/null +++ b/Task11.py @@ -0,0 +1,70 @@ +print("Enter date of birthday:") +year = int(input("Year: ")) +month = int(input("Month: ")) +day = int(input("Day: ")) + +print(day, month, year) + +print("Zodiac sign is", end=" ") #selection of zodiac sign +if month == 1: + if day < 20: + print("Goat") + else: + print("Water Bearer") +elif month == 2: + if day < 19: + print("Water Bearer") + else: + print("Fish") +elif month == 3: + if day < 21: + print("Fish") + else: + print("Ram") +elif month == 4: + if day < 20: + print("Ram") + else: + print("Bull") +elif month == 5: + if day < 21: + print("Bull") + else: + print("Twins") +elif month == 6: + if day < 22: + print("Twins") + else: + print("Crab") +elif month == 7: + if day < 23: + print("Crab") + else: + print("Lion") +elif month == 8: + if day < 23: + print("Lion") + else: + print("Virgin") +elif month == 9: + if day < 23: + print("Virgin") + else: + print("Balance") +elif month == 10: + if day < 24: + print("Balance") + else: + print("Scorpion") +elif month == 11: + if day < 22: + print("Scorpion") + else: + print("Archer") +elif month == 12: + if day < 22: + print("Archer") + else: + print("Goat") + + diff --git a/Task12.py b/Task12.py new file mode 100644 index 0000000..fc701bd --- /dev/null +++ b/Task12.py @@ -0,0 +1,25 @@ +print("Enter consumed: ") +internet = int(input("Internet traffic (Mb): ")) +minutes = int(input("talking minutes: ")) +sms = int(input("sms messages: ")) +payment = 24.99 +tax = 1.002 + +print("Base Tariff:", payment) + +if internet > 1000: + add_internet = internet - 1000 + payment += add_internet * 0.79 + print(f"You have extra {add_internet} megabytes: + {round(add_internet, 2) * 0.79} rubles") +if minutes > 60: + add_minutes = minutes - 60 + payment += add_minutes * 0.89 + print(f"You have extra {add_minutes} minutes: + {round(add_minutes, 2) * 0.89} rubles") +if sms > 30: + add_sms = sms - 30 + payment += add_sms * 0.59 + print(f"You have extra {add_sms} messages: + {round(add_sms * 0.59, 2)} rubles") + +print("Tax: 2%") +payment = round(payment * tax, 2) +print(f"Total payment: {payment}") \ No newline at end of file diff --git a/Task13.py b/Task13.py new file mode 100644 index 0000000..3e7eb40 --- /dev/null +++ b/Task13.py @@ -0,0 +1,13 @@ +import random + +guess_num = random.randint(1, 100) + +while True: + user_num = int(input("Input number:")) + if user_num == guess_num: + print("Congrats!!! You win!!!") + break + elif user_num > guess_num: + print("Too big(((") + elif user_num < guess_num: + print("Too small(((") diff --git a/Task2.py b/Task2.py new file mode 100644 index 0000000..8c97c87 --- /dev/null +++ b/Task2.py @@ -0,0 +1,14 @@ +string = input("Input string:") + +string = string.replace("a", "") +string = string.replace("e", "") +string = string.replace("i", "") +string = string.replace("o", "") +string = string.replace("u", "") +string = string.replace("A", "") +string = string.replace("E", "") +string = string.replace("I", "") +string = string.replace("O", "") +string = string.replace("U", "") + +print("Result string:", string) \ No newline at end of file diff --git a/Task3.py b/Task3.py new file mode 100644 index 0000000..d72b02c --- /dev/null +++ b/Task3.py @@ -0,0 +1,35 @@ +password = input("Enter your password: ") + +if len(password) < 16: + print("Too short(((") +else: + #check on numbers + has_digit = ('0' in password or '1' in password or '2' in password or + '3' in password or '4' in password or '5' in password or + '6' in password or '7' in password or '8' in password or + '9' in password) + + #check on letters + has_alpha = ('a' in password or 'b' in password or 'c' in password or + 'd' in password or 'e' in password or 'f' in password or + 'g' in password or 'h' in password or 'i' in password or + 'j' in password or 'k' in password or 'l' in password or + 'm' in password or 'n' in password or 'o' in password or + 'p' in password or 'q' in password or 'r' in password or + 's' in password or 't' in password or 'u' in password or + 'v' in password or 'w' in password or 'x' in password or + 'y' in password or 'z' in password or + 'A' in password or 'B' in password or 'C' in password or + 'D' in password or 'E' in password or 'F' in password or + 'G' in password or 'H' in password or 'I' in password or + 'J' in password or 'K' in password or 'L' in password or + 'M' in password or 'N' in password or 'O' in password or + 'P' in password or 'Q' in password or 'R' in password or + 'S' in password or 'T' in password or 'U' in password or + 'V' in password or 'W' in password or 'X' in password or + 'Y' in password or 'Z' in password) + + if not has_digit or not has_alpha: + print("Too weak(((") + else: + print("Strong password") diff --git a/Task4.py b/Task4.py new file mode 100644 index 0000000..71ce49c --- /dev/null +++ b/Task4.py @@ -0,0 +1,39 @@ +summa = int(input("Enter summa:")) +denomination = {100: 0, 50: 0, 10: 0, 5: 0, 2: 0, 1: 0} + +if summa >= 100: #check on 100 + amount = summa // 100 + denomination[100] += amount + summa = summa % 100 + +if summa >= 50: #check on 50 + amount = summa // 50 + denomination[50] += amount + summa = summa % 50 + +if summa >= 10: #check on 10 + amount = summa // 10 + denomination[10] += amount + summa = summa % 10 + +if summa >= 5: #check on 5 + amount = summa // 5 + denomination[5] += amount + summa = summa % 5 + +if summa >= 2: #check on 2 + amount = summa // 2 + denomination[2] += amount + summa = summa % 2 + +if summa >= 1: #check on 1 + amount = summa // 1 + denomination[1] += amount + summa = summa % 1 + +print(f"100 - {denomination[100]}", + f"50 - {denomination[50]}", + f"10 - {denomination[10]}", + f"5 - {denomination[5]}", + f"2 - {denomination[2]}", + f"1 - {denomination[1]}", sep="\n") \ No newline at end of file diff --git a/Task5.py b/Task5.py new file mode 100644 index 0000000..48ae8b7 --- /dev/null +++ b/Task5.py @@ -0,0 +1,5 @@ +user_number = int(input("Input your number:")) +if user_number % 7 == 0: + print("Magic number!") +else: + print(sum(map(int, str(user_number)))) \ No newline at end of file diff --git a/Task6.py b/Task6.py new file mode 100644 index 0000000..580fd2a --- /dev/null +++ b/Task6.py @@ -0,0 +1,9 @@ +pressure = float(input("Enter pressure in Pa: ")) +volume = float(input("Enter volume in m^3: ")) +temperature = float(input("Enter temperature in K: ")) + +R = 8.32 +print(f"P = {pressure} Pa\nV = {volume} m^3\nT = {temperature} K\nR = {R}") + +n = round((pressure * volume) / (R * temperature), 4) +print(f"Answer: n = {n} moles") \ No newline at end of file diff --git a/Task7.py b/Task7.py new file mode 100644 index 0000000..b11a7c1 --- /dev/null +++ b/Task7.py @@ -0,0 +1,5 @@ +time = int(input("Seconds:")) + +minutes = time // 60 +seconds = time % 60 +print(minutes, "minutes", seconds, "seconds") \ No newline at end of file diff --git a/Task8.py b/Task8.py new file mode 100644 index 0000000..ea5d4a0 --- /dev/null +++ b/Task8.py @@ -0,0 +1,7 @@ +string = input("Enter string: ") +reversed_str = string[::-1] + +if string == reversed_str: + print("It's polindrom") +else: + print("It's not polindrom") \ No newline at end of file diff --git a/Task9.py b/Task9.py new file mode 100644 index 0000000..257fd44 --- /dev/null +++ b/Task9.py @@ -0,0 +1,14 @@ +IP = input("Enter IP-adress: ") + +nums = IP.split(".") +if len(nums) != 4: + print("Incorrect IP-adress") +else: + nums[1] = int(nums[1]) + nums[2] = int(nums[2]) + nums[3] = int(nums[3]) + nums[4] = int(nums[4]) + if all(0 <= nums <= 255 for num in nums): + print("Correct IP-adress.") + else: + print("Incorrect IP-adress") \ No newline at end of file diff --git a/ass.py b/ass.py new file mode 100644 index 0000000..fc653ce --- /dev/null +++ b/ass.py @@ -0,0 +1,16 @@ +#если в строке больше 15 и только буквы то каждый пятый, если не только и длинна кратна 5 то вывести "отчислен" + +string = input("Input string:") + +alpha_check = string.isalpha() + +num_check = string.isdigit() + + +if alpha_check: + if len(string) > 15: + print(string[::5]) + elif len(string) % 5 == 0: + print("Отчислен") + + diff --git a/empty.py b/empty.py new file mode 100644 index 0000000..e69de29