'use strict';
const RevercedArray = function(...args) {
return Reflect.construct(Array, args, new.target);
};
Object.setPrototypeOf(RevercedArray.prototype, Array.prototype);
const arr = new RevercedArray(1, 2, 3);
console.log(arr); // RevercedArray(3) [ 1, 2, 3 ]
#include <iostream>
using std::cout, std::endl;
void printArray(short** arr, const int N){
for(int i{0}; i<N; ++i){
for(int j{0}; j < N - i; ++j){
cout << arr[i][j] << ' ';
}
cout << endl;
}
}
int main(int argc, char* argv[])
{
const int N{ 7 };
short** arr = new short*[N];
for(int i{ 0 }; i < N; ++i){
arr[i] = new short[N - i];
for(int j{0}; j < N - i; ++j){
arr[i][j] = i + 1;
}
}
printArray(arr, N);
for(int i{ 0 }; i < N; ++i){
delete[] arr[i];
}
delete[] arr;
return 0;
}
#include<iostream>
#include<clocale>
#include<iomanip>
using namespace std;
#define COLS 4
int main(int argc, char** argv)
{
setlocale(LC_ALL, "Ukrainian");
int w[][COLS] = {
{1, 3, -8, 0},
{-4, 6, 2, -5},
{3, 7, 0, 6},
{-3, 9, 11, -2}
};
cout << "Поточна матриця\n";
for (int i{0}; i < COLS; ++i)
{
for (int j{0}; j < COLS; ++j)
cout<< showpos <<w[i][j]<< setw(5);
cout << '\n';
}
cout << "\nПеретворена матриця\n";
for (int i{0}; i < COLS; ++i)
{
for (int j{0}; j < COLS; ++j)
{
if (w[i][j]>0 && w[i][j] < 6)
w[i][j] = 0;
cout<< showpos <<w[i][j]<< setw(5);
}
cout << '\n';
}
return 0;
}
for (int a = 2; a < 18; a++)
{
float t = 4 * a;
cout << "z=" << 3.5 * pow(t,2) - 7 * t + 16 << "\n";
}
{
cout << "z=" << 3.5 * pow(t,2) - 7 * t + 16 << "\n";
}
class CustomUserModelSerializer(serializers.ModelSerializer):
"""give all users"""
status = serializers.SerializerMethodField()
class Meta:
model= CustomUser
fields = ('id','email','name','status', 'avatar')
def get_status(self, obj):
if obj.is_active == True:
status = 'active'
else:
status = 'inactive'
return status
def to_representation(self, instance):
response = super().to_representation(instance)
response['avatar'] = instance.user.avatar if not None else "Путь к фото"
return response
Angular.js - React.js - Vue.js
Python -> Django
JavaScript - Node.js - Express -> SQL - MySQL - PostgreSQL -> MongoDB
python -m venv venv #последнее слово - название виртуального окружения
2. Активируйте его:.\venv\Scripts\activate
deactivate