0

How to do the coding for the catch rate of pokeball?

import random pokemon_list = ['Zubat','Eevee','Flamingo','Pikachu'] n=[1,2,3] print('Hello, welcome to Pokemon Go ') name = input('Create your name: ') age = int(input('Enter your age:')) ans = input('Are you ready to play (yes/no): ') point = 0 if ans == 'yes': print('\nYou have been given 20 pokeball, begin your adventure now?') enter1 = input('Press enter to continue>> ') pokemon=random.choice(pokemon_list) if enter1 == '': ball = 10 for i in range(10): print('\nA wild', pokemon, 'appeared!') enter2 = input('Press enter to continue >>') if enter2 == '': input('Press enter to throw your pokeball') rate = ['success','failed'] result= random.choice(rate) print(result) if result == 'success': point +=1 print('\nTotal capture:',point) print('Thanks for playing!') else: print('Goodbye

25th Mar 2022, 12:51 PM
CML
CML - avatar
3 Respostas
0
Wow!! Nice program even beginners can understand...
25th Mar 2022, 1:26 PM
Vkd
Vkd - avatar
0
So ==" is enter key?
25th Mar 2022, 1:30 PM
Vkd
Vkd - avatar
0
Try random.choices(rate, weights=(success_percentage,fail_percentage),k=1)
25th Mar 2022, 1:51 PM
Vkd
Vkd - avatar