Episode 7 of my python guide about libraries, more specifically, the time and os library. Also paramaters of subroutines and lastly the return command. I hope you enjoy!
Download link to Thonny:
https://thonny.org/
Answer to challenge:
import random, os, time
def rollDice(side):
result = random.randint(1,side)
return result
def health():
healthStat = ((rollDice(6)*rollDice(12))/2)+10
return healthStat
def strength():
strengthStat = ((rollDice(6)*rollDice(8))/2)+12
return strengthStat
while True:
print("⚔ CHARACTER BUILDER ⚔")
print()
name = input("Name your Legend:\n")
type = input("Character Type (Human, Elf, Wizard, Orc):\n")
print()
print(name)
print("HEALTH:", health())
print("STRENGTH:", strength())
print()
print("May your name go down in Legend…")
print()
again = input("Again?:\n")
if again=="No" or again=="no":
break
time.sleep(1)
os.system("clear")
Social Media:
LinkedIn - linkedin.com/in/casian-tegzes-29ab06324
TikTok - https://www.tiktok.com/@ctegzes?is_fr...
TAGS:
Python, python for hackers, python for everyone, python for everybody, python right now, you need to learn python right now, learn python, python for beginners
コメント