Skip to content
Open
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
6 changes: 6 additions & 0 deletions Task1.py
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions Task10.py
Original file line number Diff line number Diff line change
@@ -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)
70 changes: 70 additions & 0 deletions Task11.py
Original file line number Diff line number Diff line change
@@ -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")


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переписать согласно условиям(ограничениям)

25 changes: 25 additions & 0 deletions Task12.py
Original file line number Diff line number Diff line change
@@ -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}")
13 changes: 13 additions & 0 deletions Task13.py
Original file line number Diff line number Diff line change
@@ -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(((")
14 changes: 14 additions & 0 deletions Task2.py
Original file line number Diff line number Diff line change
@@ -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)
35 changes: 35 additions & 0 deletions Task3.py
Original file line number Diff line number Diff line change
@@ -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")
39 changes: 39 additions & 0 deletions Task4.py
Original file line number Diff line number Diff line change
@@ -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")
5 changes: 5 additions & 0 deletions Task5.py
Original file line number Diff line number Diff line change
@@ -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))))
9 changes: 9 additions & 0 deletions Task6.py
Original file line number Diff line number Diff line change
@@ -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")
5 changes: 5 additions & 0 deletions Task7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
time = int(input("Seconds:"))

minutes = time // 60
seconds = time % 60
print(minutes, "minutes", seconds, "seconds")
7 changes: 7 additions & 0 deletions Task8.py
Original file line number Diff line number Diff line change
@@ -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")
14 changes: 14 additions & 0 deletions Task9.py
Original file line number Diff line number Diff line change
@@ -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")
16 changes: 16 additions & 0 deletions ass.py
Original file line number Diff line number Diff line change
@@ -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("Отчислен")


Empty file added empty.py
Empty file.