Skip to content

Instantly share code, notes, and snippets.

@veretennikovalexey
Created June 28, 2022 16:06
Show Gist options
  • Save veretennikovalexey/34ff3d678001015486396aba9b0170ac to your computer and use it in GitHub Desktop.
Save veretennikovalexey/34ff3d678001015486396aba9b0170ac to your computer and use it in GitHub Desktop.
magic8ball.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "magic8ball.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyMCZp7Yuhtnrr6Lz/QmDG3Y",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/veretennikovalexey/34ff3d678001015486396aba9b0170ac/magic8ball.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "cIQGXXc6CUo8",
"outputId": "b93595ff-07f7-4387-f360-c0e1cdd4bf64"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"очень сомнительно\n"
]
}
],
"source": [
"import random\n",
"def getAnswer( answerNumber ) :\n",
" if answerNumber == 1 :\n",
" return 'Это несомненно'\n",
" elif answerNumber == 2 :\n",
" return 'Это определенно так'\n",
" elif answerNumber == 3 :\n",
" return 'Да'\n",
" elif answerNumber == 4 :\n",
" return 'Ответ туманный, попробуй ещё раз'\n",
" elif answerNumber == 5 :\n",
" return 'Спроси позже'\n",
" elif answerNumber == 6 :\n",
" return 'Сконцентрируйся и спроси снова'\n",
" elif answerNumber == 7 :\n",
" return 'Мой ответ - нет'\n",
" elif answerNumber == 8 :\n",
" return 'Перспективы не очень хорошие'\n",
" elif answerNumber == 9 :\n",
" return 'очень сомнительно'\n",
"\n",
"r = random.randint( 1, 9 )\n",
"fortune = getAnswer( r )\n",
"print( fortune )\n",
"\n",
"# Любит ли меня моя жена\n",
" "
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment