{ "cells": [ { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "85\n", "63\n", "51\n", "26\n", "30\n", "4\n", "7\n", "1\n", "17\n", "81\n" ] }, { "data": { "text/plain": [ "array([2, 2])" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "\n", "np.random.randint(0.5, 3.5)\n", "p_remove = 0.9\n", "np.random.choice([True, False], p=[p_remove, 1-p_remove])\n", "rng = np.random.default_rng(0)\n", "for _ in range(10):\n", " print(rng.integers(0,100))\n", "np.random.choice([1, 2, 3], 2, p=[0.4, 0.4, 0.2])\n" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "share = 0.8\n", "list_succ_firms = [1, 1]\n", "round(share * len(list_succ_firms)) if round(share * len(list_succ_firms)) > 0 else 1" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.9.13" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "bcdafc093860683ffb58d6956591562b7f8ed5d58147d17d71a5d4d6605a08df" } } }, "nbformat": 4, "nbformat_minor": 2 }