-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyBlock.py
More file actions
109 lines (85 loc) · 2.23 KB
/
PyBlock.py
File metadata and controls
109 lines (85 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# This is to install pip on OS
def OS_PIP_INSTALL():
import os
# Will reboot the window
os.system('pip install --upgrade pip')
os.system('pip install wheel')
os.system('pip install twine')
os.system('python example_project/setup.py sdist bdist_wheel')
os.system('twine upload dist/*')
# Standard Library for the RGB codes of the most basic colors and the Pip module
from Mod_Colors import *
from Get_Pip import *
# GENERAL FUNCTIONS
# This Shows anything on the Python Shell Interface
def Show(Text):
# This Utilizes the Python print Command
print(Text)
# Find out the type of the text
def Type(Text):
print("Type:", type(Text))
# Take the User input
def Ask(Input):
input(Input)
# LOGIC GATES
# This is the And Gate
def And_Gate(Input_1, Input_2):
# Derived from the truth table
if Input_1 == 0 and Input_2 == 0:
return 0
if Input_1 == 1 and Input_2 == 0:
return 0
if Input_1 == 0 and Input_2 == 1:
return 0
if Input_1 == 1 and Input_2 == 1:
return 1
# This is the Or gate
def Or_Gate(Input_1, Input_2):
# Derived from the truth table
if Input_1 == 0 and Input_2 == 0:
return 0
if Input_1 == 1 and Input_2 == 0:
return 1
if Input_1 == 0 and Input_2 == 1:
return 1
if Input_1 == 1 and Input_2 == 1:
return 1
# This is a not gate
def Not_Gate(Input_1):
# Derived from the truth table
if Input_1 == 0:
return 1
if Input_1 == 1:
return 0
# This is a Nor Gate
def Nor_Gate(Input_1, Input_2):
if Input_1 == 0 and Input_2 == 0:
return 1
if Input_1 == 1 and Input_2 == 0:
return 0
if Input_1 == 0 and Input_2 == 1:
return 0
if Input_1 == 1 and Input_2 == 1:
return 0
# This is a Nand Gate
def Nand_Gate(Input_1, Input_2):
if Input_1 == 1 and Input_2 == 1:
return 0
else:
return 1
# This is an XNOR Gate
def XNOR_Gate(Input_1, Input_2):
if Input_1 != Input_2:
return 1
else:
return 0
# This is an XOR Gate
def XOR_Gate(Input_1, Input_2):
if Input_1 == Input_2:
return 1
else:
return 0
# STRING MATH
# Addition of Strings
def Str_Math(StrA, StrB):
print(StrA + StrB)