Dmitry Telenkov vor 1 Jahr
Ursprung
Commit
56b6768576
3 geänderte Dateien mit 108 neuen und 0 gelöschten Zeilen
  1. BIN
      courses/cpp_1/hello_word
  2. 61 0
      courses/cpp_1/hello_word.cpp
  3. 47 0
      courses/python_for_begginers/list.py

BIN
courses/cpp_1/hello_word


+ 61 - 0
courses/cpp_1/hello_word.cpp

@@ -0,0 +1,61 @@
+#include <iostream>
+using namespace std;
+
+void sum();
+void out_stream();
+void in_stream();
+void in_stream_get();
+
+
+int main()
+{
+    std::cout << "Hello, World!\n";
+    // sum();
+    // out_stream();
+    // in_stream();
+    in_stream_get();
+    return 0;
+}
+
+//
+void sum()
+{
+    int a = 0;
+    int b = 0;
+
+    cout << "Enter a and b: ";
+    cin >> a >> b;
+    cout << "a + b = " << (a + b) << endl;
+}
+
+// in/out streams
+void out_stream()
+{
+    int i = 42;
+    double d = 3.14;
+    const char *s = "C-style string";
+
+    std::cout << "This is integer " << i << "\r\n";
+    std::cout << "This is double " << d << "\r\n";
+    std::cout << "This is a \"" << s << "\"\n";
+}
+
+void in_stream()
+{
+    int i = 42;
+    double d = 3.14;
+
+    std::cout << "Enter an integer and a double:\r\n";
+    std::cin >> i >> d;
+    std::cout << "Your input is " << i << ", " << d << "\r\n";
+}
+
+void in_stream_get()
+{
+    char c = '\0';
+    while (std::cin.get(c)) {
+        if (c != 'a')
+            std::cout << c;
+        else break;
+    }
+}

+ 47 - 0
courses/python_for_begginers/list.py

@@ -88,4 +88,51 @@ def list_6():
     print(*numbers)
     print(*numbers)
 
 
 # list_6()
 # list_6()
+    
+def list_7():
+    keywords = ['False', 'True', 'None', 'and', 'with', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'try', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'while', 'yield']
+    new_keywords = [i[1:] for i in keywords]
+    lengths = [len(i) for i in keywords]
+    # new_keywords = [i for i in keywords if len(i) >= 5]
+    palindromes = [i for i in range(100, 1000) if i//100 == i%100%10]
+    print(new_keywords)
+    print(lengths)
+    print(palindromes)
+
+# list_7()
+    
+def list_8():
+    n = int(input())
+    numbers = [i**2 for i in range(1, n+1)]
+    for i in numbers:
+        print(i)
+
+# list_8()
+        
+def list_9():
+    numbers = list(map(int, input().split()))
+    new_numbers = [i**3 for i in numbers]
+    print(new_numbers)
+
+# list_9()
+
+def list_10():
+    words = input().split()
+    for i in words:
+        print(i)
+
+# list_10()
+        
+def list_11():
+    data = [j for i in input().split() for j in i if j.isdigit()]
+    print(''.join(data))
+
+# list_11()
+    
+def list_12():
+    data = list(map(int, input().split()))
+    new_data = [i**2 for i in data if i%2 == 0 and (i**2)%10 != 4]
+    print(*new_data)
+
+# list_12()