gosha gosha

Generation

generate functionSun, 12 Feb 2023

Averting shutdown by chance If the chance is 20%, the shutdown will fail! The chance of shutdown success is 70%.

import random def shutdown(chance): if chance > 1: chance = chance / 100 random_num = random.random() if random_num > chance: print('shutdown succeed') else: print('shutdown failed') shutdown(20)

Want to kickstart your project?Use the new AI Studio to create your code