Как мне добавить текст сбоку цетов? from tkinter import *
def red():
label.config(text='Red')
entry.delete(0, END)
entry.insert(0, '#ff0000')
def orange():
label.config(text='Orange')
entry.delete(0, END)
entry.insert(0, '#ff7d00')
def yellow():
label.config(text='Yellow')
entry.delete(0, END)
entry.insert(0, '#00')
def blue():
label.config(text='Blue')
entry.delete(0, END)
entry.insert(0, '#343aeb')
root = Tk()
root.title('Colors')
root.geometry('1920x1080')
label = Label(root, text='Colors', justify='center', anchor='c')
label.pack()
entry = Entry(root, justify='center', bd=5, bg='#f2f2f2')
entry.pack()
button1 = Button(width=100, bg='red', command=red)
button1.pack()
button2 = Button(width=100, bg='orange', command=orange)
button2.pack()
button3 = Button(width=100, bg='yellow', command=yellow)
button3.pack()
button4 = Button(width=100, bg='blue', command=blue)
button4.pack()
root.mainloop()
not(a) and (b or not(c))
Код на Python:
for a in range(0,2):
for b in range(0,2):
for c in range(0,2):
f=not(a) and (b or not(c))
print('A = ',a,'B = ',b,'C = ',c,'F = ',f)
б) А и не ( В и или не С) получим такое выражение:
a and (b or not(c))
Код на Python:
for a in range(0,2):
for b in range(0,2):
for c in range(0,2):
f=a and (b or not(c))
print('A = ',a,'B = ',b,'C = ',c,'F = ',f)
в) не ( не А или В и С) преобразуем:
a and (b or c)
Код на Python:
for a in range(0,2):
for b in range(0,2):
for c in range(0,2):
f=a and (b or c)
print('A = ',a,'B = ',b,'C = ',c,'F = ',f)
#include <ctime>
int main()
{
using namespace std;
const int SIZE = 25;
int massive[SIZE];
//1й пункт
cout << "Enter number: ";
int num;
cin >> num;
int s = 0;
for (int i = 1; i <= num; i++)
if (num % i == 0)
if (i % 2 == 1)
s = s + i;
cout << "The sum of the odd divisors: " << s << endl;
//2й пункт
for (int i = 0; i < SIZE; i++)
{
cout << "Enter #" << i + 1 << " element: ";
cin >> massive[i];
}
for (int i = 0; i < SIZE; i++)
if (massive[i] < 0)
{
massive[i] = 0;
break;
}
for (int i = 0; i < SIZE; i++)
cout << massive[i] << ' ';
//3й пункт
for (int i = 0; i < SIZE; i++)
massive[i] = i + 1;
for (int i = 0; i < SIZE; i++)
if (massive[i] % 3 == 0)
massive[i] *= massive[2];
cout << endl;
for (int i = 0; i < SIZE; i++)
cout << massive[i] << ' ';
//4й пункт
srand(time(0));
for (int i = 0; i < SIZE; i++)
massive[i] = rand();
cout << endl;
for (int i = 0; i < SIZE; i++)
cout << massive[i] << ' ';
cout << endl;
cout << "Enter number: ";
int num2;
cin >> num2;
bool ifsum = false;
for (int i = 0; i < SIZE - 1; i++)
if (massive[i] + massive[i + 1] == num2)
{
ifsum = true;
break;
}
if (ifsum)
cout << "yes";
else
cout << "no";
cout << endl;
return 0;
}