hrithik254 / digitallogicsonsage Goto Github PK
View Code? Open in Web Editor NEWSolving semester 3 digital logics problem on SageMath
Solving semester 3 digital logics problem on SageMath
`def sage_boolexp(string):
""this function converts boolean expresssion written
using *, +, ' representing AND, OR, NOT
operations to sage interpretable expression""
literal_list0 = ["&" if i == "*" else i for i in string]
literal_list1 = ["|" if i == "+" else i for i in literal_list0]
for i in range(len(literal_list1)):
if literal_list1[i] == "'":
del literal_list1[i]
if literal_list1[i-1] == ")":
j = i-1
while literal_list1[j] != "(":
j += -1
literal_list1.insert(j,'~')
i += 1
else:
literal_list1.insert(i-1,"~")
return_string = ''
for literal in literal_list1:
return_string += literal
return return_string`
This is the current code which converts a boolean expression entered by the user using * for AND, + for OR and ' for NOT.
currently it requires the user to enter * to indicate AND, what I want is that the user enters ab' + bc
instead of a*b' + b*c
The main purpose of this function is to save time. note: the * and + expressions can contain spaces but y'
cannot be written as y '
. a + b *d'
is acceptable but a + b *d '
would give error. This is alo a potential issue, but it can be fixed later
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.