-
Notifications
You must be signed in to change notification settings - Fork 0
Laba1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Andrusha-cpp
wants to merge
18
commits into
main
Choose a base branch
from
Laba1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Laba1 #1
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f634181
Add tasks for lab1
Andrusha-cpp 4f83e0c
Remove cycles
Andrusha-cpp 37de893
Remove cycles
Andrusha-cpp a75b88e
Delete godamn folder
Andrusha-cpp 7b18f12
Remove cycles and ass f-strings
Andrusha-cpp 486c28d
Add f-strings and add new output
Andrusha-cpp 380430d
Remove round()
Andrusha-cpp 06f1ce3
Minor changes
Andrusha-cpp d2b4149
Rewrite to conditions
Andrusha-cpp 885da56
Make output more understandable
Andrusha-cpp 0bed916
Add f-strings to output
Andrusha-cpp 0acecc6
Rewrite to conditions
Andrusha-cpp 7281822
Rewrite without cycles
Andrusha-cpp ad2bae1
add sum of digits of the number
Andrusha-cpp 4d341ec
remove cycle
Andrusha-cpp df60890
Add ass.py
Andrusha-cpp 1b82f6b
Move file
Andrusha-cpp c549e5d
new ass.py
Andrusha-cpp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
|
||
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(((") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переписать согласно условиям(ограничениям)