I wrote this dice game as beginner practice. This is working code, but I would like to improve it by adding more functions. Though, since I am still a beginner, I don't know how, so help would be appreciated!
import random
print('Time to go gambling! Press ctrl + enter, or RUN (the big red button), to roll!')
dice = random.randint (1,20)
print(str(dice))
count = 1
while dice != 20:
dice = random.randint (1,20)
print(str(dice))
count +=1
if count == 1:
print('It took you ' + str(count) + ' try to get a 20... average.')
else:
print('It took you ' + str(count) + ' tries to get a 20... embarrassing.')
(Edit: Thanks for all the help! I still don't fully understand the syntax, but I'll learn)