{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "92bc0c3c285741098371b80fbf2b566a",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(Checkbox(value=False, description='a'), Checkbox(value=False, description='b'), Output()…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<function __main__.VaEtVient(a, b)>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Il faut importer la fonction interact() du module ipywidgets\n",
    "from ipywidgets import interact\n",
    "\n",
    "# Définition de la fonction logique à simuler\n",
    "def VaEtVient(a, b):\n",
    "    # Expression booléenne de la fonction en python\n",
    "    L = ((not a) and b) or ((not b) and a)\n",
    "    # Résultat interactif à afficher\n",
    "    return (print(f\"Si a = {a} et b = {b} alors la lampe L = {L}\"))\n",
    "\n",
    "# Appel de la fonction interact() qui appelle la fonction logique à simuler\n",
    "interact(VaEtVient, a = False, b = False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}