Skip to content

Instantly share code, notes, and snippets.

@veretennikovalexey
Created June 25, 2022 18:57
Show Gist options
  • Save veretennikovalexey/9ef7bc502916aa9cf62dbf4ed5e537bd to your computer and use it in GitHub Desktop.
Save veretennikovalexey/9ef7bc502916aa9cf62dbf4ed5e537bd to your computer and use it in GitHub Desktop.
Untitled1.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled1.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyOeTDpVX2CaZL880txiR8BG",
"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/9ef7bc502916aa9cf62dbf4ed5e537bd/untitled1.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_1wtF1LPNBxp",
"outputId": "a63d1b48-c9c9-4698-ed87-60f7f60f9898"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"20\n",
"less\n",
"10\n",
"less\n",
"5\n",
"more\n",
"8\n",
"more\n",
"9\n",
"yes ! Количество попыток: ( 5 )\n"
]
}
],
"source": [
"import random\n",
"rr = random.randint( 1, 100 )\n",
"for ii in range( 1, 10 ) :\n",
" guess = int( input() )\n",
" if guess < rr :\n",
" print( 'more' )\n",
" elif guess > rr :\n",
" print( 'less' )\n",
" else :\n",
" break \n",
"if guess == rr :\n",
" print( 'yes ! Количество попыток: ( ' + str( ii ) + ' )' ) \n",
"else :\n",
" print( 'noooo. It was ' + str( zz ) ) \n"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment