Boolean Algebra

Boolean Algebra

Simple
DE Ελληνικά EN ES FR IT JA RU UK

Στα μαθηματικά και στη μαθηματική λογική, η Άλγεβρα Boole αποτελεί έναν τομέα της άλγεβρας στον οποίο οι τιμές των μεταβλητών είναι Αληθής(True) ή Ψευδής(False) και συνήθως συμβολίζονται με το 1 και το 0 αντίστοιχα. Σε αντίθεση με την κλασσική άλγεβρα, στην οποία οι τιμές των μεταβλητών είναι αριθμοί και οι βασικές λειτουργίες είναι η πρόσθεση και ο πολλαπλασιασμός, οι κύριες λειτουργίες της Άλγεβρας Boole είναι η σύζευξη (συμβολίζεται με ∧), η διάζευξη (συμβολίζεται με ∨) και η άρνηση(συμβολίζεται με ¬).

Σε αυτή την αποστολή θα υλοποιήσεις μερικές λογικές πράξεις:
- "conjunction(σύζευξη)" συμβολίζεται ως x ∧ y, και υπολογίζεται ως εξής: x ∧ y = 1 αν x = y = 1 και x ∧ y = 0 σε κάθε άλλη περίπτωση.
- "disjunction(διάζευξη)" συμβολίζεται ως x ∨ y, και υπολογίζεται ως εξής: x ∨ y = 0 αν x = y = 0 και x ∨ y = 1 σε κάθε άλλη περίπτωση.
- "implication(συνεπαγωγή)" (material implication) συμβολίζεται ως x→y και μπορεί να περιγραφεί ως ¬ x ∨ y. Αν το x είναι Αληθές τότε η τιμή της πράξης x → y είναι η τιμή του y. Αλλά αν το x είναι Ψευδές τότε η τιμή του y αγνοείται και το αποτέλεσμα είναι η τιμή Αληθής.
- "exclusive(αποκλειστική διάζευξη)" (αποκλειστικό ή) συμβολίζεται ως x ⊕ y και μπορεί να περιγραφεί ως (x ∨ y)∧ ¬ (x ∧ y). Αποκλείει την πιθανότητα να ισχύουν ταυτόχρονα και το x και το y. Με αριθμητικούς όρους αντιστοιχεί στη δυαδική πρόσθεση, στην οποία 1 + 1 = 0.
- "equivalence(ισοδυναμία)" συμβολίζεται ως x ≡ y και μπορεί να περιγραφεί ως ¬ (x ⊕ y). Το αποτέλεσμα είναι Αληθές όταν τα x και y έχουν την ίδια τιμή.

Παρακάτω δίνονται οι πίνακες αληθείας για κάθε μια από τις προηγούμενες πράξεις:

 x | y | x∧y | x∨y | x→y | x⊕y | x≡y |
--------------------------------------
 0 | 0 |  0  |  0  |  1  |  0  |  1  |
 1 | 0 |  0  |  1  |  0  |  1  |  0  |
 0 | 1 |  0  |  1  |  1  |  1  |  0  |
 1 | 1 |  1  |  1  |  1  |  0  |  1  |
--------------------------------------

Σου δίνονται δύο λογικές τιμές x και y σε μορφή 1 και 0 και το όνομα μιας πράξης όπως περιγράφηκαν παραπάνω. Σκοπός είναι να υπολογίσεις το αποτέλεσμα της πράξης και να το επιστρέψεις σε μορφή 0 - 1.

Είσοδος: Τρεις παράμετροι. Τα X και Y σε μορφή 0, 1. Το όνομα μιας πράξης σε μορφή string.

Έξοδος: Το αποτέλεσμα σε μορφή 0,1.

Παράδειγμα:

assert boolean(0,...
You should be an authorized user in order to see the full description and start solving this mission.
45
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission