Hello, I am struggling with getting this DICE GAME to function properly. I have made an attempt to try and get the overall program to debug and run without errors, but to no avail. If I can get some help getting my PYTHON program to Run Correctly. #Lab 7-3 The Dice Game #add libraries needed playerTwo = 'NO NAME' playerOne = 'NO NAME' inputNames = ("enter name") import random #the main function def main(): print #initialize variables endProgram = "no" playerOne = "NO NAME" playerTwo = "NO NAME" #call to inputNames playerOne, playerTwo = inputNames(playerOne, playerTwo) #while loop to run program again while "endProgram" == 'no': #initialize variables p1number = 0 p2number = 0 winnerName = 'NO NAME' #call to rollDice winnerName = "rollDice"(p1number, p2number, playerOne, playerTwo, winnerName) #call to displayInfo displayInfo: ("winnerName") #end of while loop endProgram = "raw_input"('Do you want to end program?(Enter yes or no):') endProgram = "raw_input"('Do you want to end program? (Enter yes or no): ') #this function gets the players names def inputNames(playerOne, playertwo): playerOne= "raw_input"('Enter player 1 name: ') playerTwo= "raw_input"('Enter player 2 name: ') return playerOne, playerTwo #this function will get the random values def rollDice(p1number, p2number, playerOne, playerTwo, winnerName): p1number = random.randint(1, 6) p2number = random.randint(1, 6) if p1number == p2number: winnerName = "TIE" elif p1number>p2number: winnerName=playerOne else: winnerName=playerTwo return winnerName #this function displays the winner def displayinfo(winnerName): print: "The winner is" (winnerName) # calls main main(
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images