TelenkovDmitry 1 рік тому
батько
коміт
d145701ece

+ 0 - 0
courses/class.py


+ 134 - 3
courses/python_for_begginers/misc.py

@@ -612,8 +612,139 @@ print(a, b, c, d)
 
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-from string import ascii_lowercase
+# from string import ascii_lowercase
 
-d = {ascii_lowercase[i]: i + 1 for i in range(len(ascii_lowercase))}
-print(d)
+# d = {ascii_lowercase[i]: i + 1 for i in range(len(ascii_lowercase))}
+# print(d)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# my_dict = {1: "one", 2: "two"}
+# d1 = {'a': 100, 'b': 200, 'c': 333}
+# d2 = {'x': 300, 'y': 200, 'z': 777}
+
+# print(type(my_dict.items()))
+
+# for i in my_dict.items():
+#     print(i[0], i[1])
+
+# d2.update(d1)
+# print(d2)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# n = int(input())
+# d = {}
+
+# for i in range(n):
+#     name = input()
+#     if name not in d:
+#         d[name] = 0
+#         print('OK')
+#     else:
+#         d[name] += 1
+#         print(name + str(d[name]))
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# countries = {
+#     "Sweden": ["Stockholm", "Göteborg", "Malmö"],
+#     "Norway": ["Oslo", "Bergen", "Trondheim"],
+#     "England": ["London", "Birmingham", "Manchester"],
+#     "Germany": ["Berlin", "Hamburg", "Munich"],
+#     "France": ["Paris", "Marseille", "Toulouse"]
+# }
+
+# city = input()
+# flag = False
+
+# for key in countries.keys():
+#     if city in countries[key]:
+#         print(f'INFO: {city} is a city in {key}')
+#         flag = True
+    
+# if flag == False:
+#     print(f'ERROR: Country for {city} not found')
+    
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# from pprint import pprint
+
+# user = {
+#     "id": 4170,
+#     "uid": "5e941db5-9e0f-4f94-9fc5-734110c6be14",
+#     "password": "SyUpfo1ljm",
+#     "first_name": "Teresa",
+#     "last_name": "Wehner",
+#     "username": "teresa.wehner",
+#     "email": "teresa.wehner@email.com",
+#     "gender": "Non-binary",
+#     "phone_number": "+674 424.561.2776",
+#     "social_insurance_number": "637316241",
+#     "date_of_birth": "1993-08-17"
+# }
+
+# user['secret'] = user.pop('password')
+# user['surname'] = user.pop('last_name')
+# pprint(user)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# l = list(map(int, input().split()))
+
+# d = {}
+# cnt = -3
+# for i in range(len(l) - 1):
+#     if len(d) == 0:
+#         d = {l[-2]:l[-1]}    
+#     else:
+#         d = {l[cnt]:d}
+#         cnt -= 1
+
+# print(d)    
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# s = 'waejskldcnvawefigas,dfaswe'
+# d = {}
+# for i in s:
+#     if i.isalpha():
+#         d[i] = d.get(i, 0) + 1
+
+# print(d)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# workers = {
+#     'employer1': {'name': 'Jhon', 'salary': 7500},
+#     'employer2': {'name': 'Emma', 'salary': 8000},
+#     'employer3': {'name': 'Brad', 'salary': 500}
+# }
+
+# workers['employer3']['salary'] = 8500
+# print(workers)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# supermarket = {
+#     "milk": {"quantity": 20, "price": 1.19},
+#     "biscuits": {"quantity": 32, "price": 1.45},
+#     "butter": {"quantity": 20, "price": 2.29},
+#     "cheese": {"quantity": 15, "price": 1.90},
+#     "bread": {"quantity": 15, "price": 2.59},
+#     "cookies": {"quantity": 20, "price": 4.99},
+#     "yogurt": {"quantity": 18, "price": 3.65},
+#     "apples": {"quantity": 35, "price": 3.15},
+#     "oranges": {"quantity": 40, "price": 0.99},
+#     "bananas": {"quantity": 23, "price": 1.29}
+# }
+
+# sum = 0
+
+# for i in supermarket.keys():
+#     sum += supermarket[i]['quantity'] * supermarket[i]['price']
+    
+# print(sum)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

+ 22 - 0
cpp/.vscode/c_cpp_properties.json

@@ -0,0 +1,22 @@
+{
+    "configurations": [
+        {
+            "name": "Win32",
+            "includePath": [
+                "${workspaceFolder}/**", 
+                "C:\\Users\\user\\scoop\\apps\\gcc\\current\\include\\**"
+            ],
+            "defines": [
+                "_DEBUG",
+                "UNICODE",
+                "_UNICODE"
+            ],
+            "windowsSdkVersion": "8.1",
+            "compilerPath": "C:\\Users\\user\\scoop\\apps\\gcc\\current\\bin\\g++.exe",
+            "cStandard": "c11",
+            "cppStandard": "c++17",
+            "intelliSenseMode": "gcc-x86"
+        }
+    ],
+    "version": 4
+}

+ 53 - 0
cpp/.vscode/launch.json

@@ -0,0 +1,53 @@
+{
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "g++.exe build and debug active file",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
+            "args": [],
+            "stopAtEntry": false,
+            "cwd": "${workspaceFolder}",
+            "environment": [],
+            "externalConsole": false,
+            "MIMode": "gdb",
+            "miDebuggerPath": "C:\\Users\\user\\scoop\\apps\\gcc\\current\\bin\\gdb.exe",
+            "setupCommands": [
+                {
+                    "description": "Enable pretty-printing for gdb",
+                    "text": "-enable-pretty-printing",
+                    "ignoreFailures": true
+                }
+            ],
+            "preLaunchTask": "g++.exe build active file",
+            "internalConsoleOptions": "neverOpen"
+        },
+        {
+            "name": "C/C++: g++.exe build and debug active file",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
+            "args": [],
+            "stopAtEntry": false,
+            "cwd": "${fileDirname}",
+            "environment": [],
+            "externalConsole": false,
+            "MIMode": "gdb",
+            "miDebuggerPath": "gdb.exe",
+            "setupCommands": [
+                {
+                    "description": "Enable pretty-printing for gdb",
+                    "text": "-enable-pretty-printing",
+                    "ignoreFailures": true
+                },
+                {
+                    "description": "Set Disassembly Flavor to Intel",
+                    "text": "-gdb-set disassembly-flavor intel",
+                    "ignoreFailures": true
+                }
+            ],
+            "preLaunchTask": "C/C++: g++.exe build active file"
+        }
+    ]
+}

+ 28 - 0
cpp/.vscode/tasks.json

@@ -0,0 +1,28 @@
+{
+	"version": "2.0.0",
+	"tasks": [
+		{
+			"type": "cppbuild",
+			"label": "C/C++: g++.exe build active file",
+			"command": "C:\\Users\\user\\scoop\\apps\\gcc\\current\\bin\\g++.exe",
+			"args": [
+				"-fdiagnostics-color=always",
+				"-g",
+				"${file}",
+				"-o",
+				"${fileDirname}\\${fileBasenameNoExtension}.exe"
+			],
+			"options": {
+				"cwd": "${fileDirname}"
+			},
+			"problemMatcher": [
+				"$gcc"
+			],
+			"group": {
+				"kind": "build",
+				"isDefault": true
+			},
+			"detail": "compiler: C:\\Users\\user\\scoop\\apps\\gcc\\current\\bin\\g++.exe"
+		}		
+	]
+}

+ 94 - 0
cpp/test.cpp

@@ -0,0 +1,94 @@
+#include <iostream>
+#include <stdio.h>
+#include <math.h>
+
+using namespace std;
+
+class Date
+{
+public:
+    Date() : day(1), month(1), year(2000) {}
+    Date(int d, int m, int y) : day(d), month(m), year(y) {}
+    ~Date() {}
+private:
+    int day;
+    int month;
+    int year;
+
+public:
+    int getDay() {
+        return day;
+    }
+    void print()
+    {
+        cout << day << "." << month << "." << year << endl;
+    }
+
+};
+
+//
+class Power
+{
+public:
+    Power() {}
+    Power(double val_one, double val_two) : a(val_one), b(val_two) {}
+
+private:
+    double a;
+    double b;
+
+public:
+    void set(double val_one, double val_two)
+    {
+        a = val_one;
+        b = val_two;
+    }
+
+    double calculate()
+    {
+        return pow(a, b);
+    }
+};
+
+
+//
+class RGB 
+{
+public:
+    RGB() : red(0), green(0), blue(0) {}
+    RGB(unsigned char r, unsigned char g, unsigned char b) : red(r), green(g), blue(b) {}
+
+private:
+    unsigned char red;
+    unsigned char green;
+    unsigned char blue;
+
+public:
+    void print() {
+        cout << "(" << (int)red << "," << (int)green << "," << (int)blue << ")" << endl;
+    }
+    void invert() {
+        red = 255 - red;
+        green = 255 - green;
+        blue = 255 - blue;
+    }
+};
+
+
+int main() {
+    // Date today(6, 9, 2023);
+    // today.print();   
+
+    // Date birthday;
+    // birthday.print();
+
+    // Power p(2, 2);
+    // cout << p.calculate() << endl;
+
+    RGB rgb(12, 54, 231);
+    rgb.print();
+    rgb.invert();
+    rgb.print();
+
+    return 0;
+}


+ 1 - 0
powershell/file.c

@@ -0,0 +1 @@
+#define NAME "sadfasdf"

+ 15 - 0
powershell/test.ps1

@@ -0,0 +1,15 @@
+"Hello world!"
+
+$Text = Get-Content file.c
+$Text
+Pause
+#Get-PnpDevice -PresentOnly | Where-Object {$ _. InstanceId -match '^ USB'}
+
+
+function MyFunc
+{
+    Get-Content file.c
+    (Get-Content file.c).Length
+"sdfasdf"
+}
+