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
Бадьянов Владимир РПО 24/4 | |
#include <iostream> | |
using namespace std; | |
//task 1 | |
int main() { | |
int a, i = 1, sum = 0; | |
cin >> a; | |
if (a <= 0) { |
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
Бадьянов Владимир РПО 24/4 | |
#include <iostream> | |
#include <cmath> | |
#include <string> | |
using namespace std; | |
// task 1 | |
int main() { | |
int num; | |
cout << "Введите целое число: "; | |
cin >> num; |
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
""Бадьянов Владимир Сергеевич РПО 24/4"" | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
//Task 1 | |
int main() { | |
int a, b, x, y; | |
cout << "Введите значения a, b, x, y: "; |
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
#1 | |
list1 = [1, 3, 5, 7, 2, 4, 6, 8] | |
maxS = int(input(":")) | |
list2, list3 = [], [] | |
sumS = 0 | |
for i in list1: | |
if sumS + i <= maxS: | |
list2.append(i) | |
sumS += i | |
elif i > maxS: |
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
# 1 | |
a = [int(input("Введите число ->")) for x in range(5)] | |
print(*a, sep=", ") | |
# 2 | |
x = [x ** 2 for x in range(10)] | |
print(*x) | |
sumTotal = 0 | |
for i in x: | |
sumTotal += i | |
print(sumTotal, end = " ") |
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
# Квадрат | |
for i in range(10): | |
for j in range(10): | |
print("*",end=" ") | |
print() | |
# Пустой квадрат | |
for row in range (10): | |
for col in range(10): | |
if row == 0 or col == 9 or row == 9 or col == 0: | |
print("*", end = " ") |
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
print("------ Регистрация -----") | |
regLogin = input("Введите логин:") | |
regPassword = input("Введите пароль:") | |
isRegistration = False | |
if len(regLogin) >= 5 and len(regPassword) >= 8: | |
print("Успешная регистрация!") | |
isRegistration = True | |
else: | |
print("Условия не соблюдены!") |
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
[and | or | not] x = 5, y = 15, z =-43 | |
expression = ((x < y) and (y > z) and (x != 0)) | |
таблица: | |
and or | |
100 101 | |
010 011 | |
111 000 | |
expression = ((x > y) or ( y > z) or (x!=0)) | |
x = 15 | |
y = 4 |
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
#1: Конвертация суммы в разные валюты | |
def convert_to_currencies(amount, rate_dollar, rate_euro, rate_yuan): | |
dollar_value = amount / rate_dollar | |
euro_value = amount / rate_euro | |
yuan_value = amount / rate_yuan | |
print(f"{amount} рублей = {round(dollar_value, 2)} долларов") | |
print(f"{amount} рублей = {round(euro_value, 2)} евро") | |
print(f"{amount} рублей = {round(yuan_value, 2)} юаней") |
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
Синтаксический сахар - это (удобнее но дольше по времмени) элементы языка программирования, которые делают код более удобочитаемым и лаконичным, но не добавляют новую функциональность. Другими словами, это конструкции, которые можно убрать из языка, не теряя его возможностей, но при этом код станет более сложным и трудночитаемым. | |
Синтаксическая соль - это (менее удобнее но более быстрее по времени ) элементы синтаксиса, которые намеренно делают код менее удобным или требуют дополнительных шагов, чтобы предотвартить ошибки или заставить программиста явно осозать последствия сових действий. Это добавляется для повышения ясности или безопастности кода, хотя может делать его более сложным для написания. | |
Тип данных - это характеристика которая определяет какие операции можно выполнять над данными. | |
int - это целые числа например (1,2,3,-5, -4, 0) | |
float - это числа с плавающей точкой например (1.5, 0.05, -3.431) | |
bool - логический (True, False) | |
True - Истрина - Да - 1 | |
False - Ложь - нет - 0 | |
str - Строчные ( 'Олег' |
NewerOlder