非常に初心者.
ちょうどこのコミュニティを見つけました、そして、私は私がしたことがうれしいです!私のタイトルのように、非常に初心者が言うように、Pythonの私の最後の目標は、ネットワークの自動化のためのスキルアップとそれを利用することです.
私はどのように多くの側面とどのように多くのサイコロを決定するためにユーザー入力を取るシンプルなダイスローラー今日取り組んだ.
ユーザーがサイコロ側/数字入力への手紙を入力するならば、エラーに加えるつもりです.それを離れて裂くか、私に私が加えることができる何かについてのアイディアを与えてください!
私はどのように多くの側面とどのように多くのサイコロを決定するためにユーザー入力を取るシンプルなダイスローラー今日取り組んだ.
ユーザーがサイコロ側/数字入力への手紙を入力するならば、エラーに加えるつもりです.それを離れて裂くか、私に私が加えることができる何かについてのアイディアを与えてください!
import random
# Determine a random side for each number rolled
def rollDice():
# Get how many sides a dice has
print("How many sides does the dice have?" )
diceSideNum = input()
# Get number of those dice to role
print("How many " + diceSideNum + " sided dice should we roll? ")
diceNum = input()
# incr variable to increment by 1 to roll correct amount of dice
incr = 0
# while incr doesn't equal number of dice rolled, iterate.
while int(incr) != int(diceNum):
# random dice number is between 1 and the # chosen by the user
num = random.randrange(1, int(diceSideNum))
# Side of the dice randomly chosen and printed to display
print(num)
# test incremented by 1
test += 1
# reroll() asks essentially to play again.
reroll()
def reroll():
reroll = input("Roll again? ")
if reroll == "yes":
rollDice()
else:
print("Good-bye")
rollDice()
Reference
この問題について(非常に初心者.), 我々は、より多くの情報をここで見つけました https://dev.to/onthefritz/very-much-a-beginner-15phテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol