Calculations in python -


I find it difficult to calculate a portion of my program in Python.

Random Import CharacterOne = Input ("Enter the first player name:") CharacterTwo = Input ("Enter another player name:") ch1str = int (input is a strength of the character : ")) ch1skl = int (a skill input (CharacterOne +": ":)) ch2skl = int (a skill input (CharacterTwo +": ")) ch2str = int (input (CharacterTwo + one" strength ")) strdif = int (ch1str-ch2str) If strdif & LT; 0: strdif = ch2str-ch1str strmod = strdif // 5 skldif = int (ch1skl-ch2skl) If skldif & LT; 0: skldif = ch2skl- Ch1skl sklmod = skldif // 5 number1 = random.randrange (1,6) nUM2 = random.randrange (1,6) if Number 1 & gt; nUM2: ch1str + = strmod ch1skl + = sklmod ch2str- = strmod ch2skl- = sklmod play1 = true if nUM2 & gt; No. 1: ch2str + = strmod ch2skl + = sklmod ch1str- = strmod ch1skl- = Sklmod play1 = wrong if ch1skl & lt; 0: ch1skl = 0 if ch2skl & lt; 0: ch2skl = 0 if ch1str = 0: print (CharacterOne + "now dead") that ch2str = 0: print (char two + "now Print (character + two + ")" if "play1 == is correct: Print (Characteron +" won this round, now is "," 1 "," strength "and", ch1skl, "skill) This round is lost, now is "ch2str," strength and "ch2skl," skill) if play1 == incorrect: print (characters "live in this round Print "Character On +" has lost this round, is now ", C1 UT," strength and ", C1 SCL," skill "," now, ", ch2str," strength and ", ch2skl," skill " )

This is the code for any reason. I record strength and skill for both characters which prints the program and what I have entered is actually counting new strengths and skills. Which uses str and skl mod and dif.

There are so many things, and I'm not sure that you understand what your argument is really In this case, regardless of the strength or skill of any player, the winner of the goal is determined by a random number. Also, please refer to other and alif statements for conditionals. Import the random import math CharacterOne = Input ("Enter the name of the first player:") Letter = 2 input ("Enter second player name:") ch1str = int (input (characters) The power of "+":)) ch1skl = int (input is a skill of "in": ")) ch2str = int (input is the strength of two:")) ch2skl = int (input ( Character + Two +) is the skill: ")) # You do not have to insert the int here, your wars are already ints. In addition, you can use full value to avoid additional conditional. Strdif = stomach (ch1str-ch2str) strmod = strdif / 5 skldif = stomach (ch1skl-ch2skl) sklmod = skldif // 5 number1 = random.randrange (1,6) if number 1 & gt; = 3: ch1str + = strmod ch1skl + = sklmod ch2str- = strmod ch2skl- = sklmod play1 = a and it's true: ch2str + = strmod ch2skl + = sklmod ch1str- = strmod ch1skl- = sklmod play1 = false #no idea What are you doing here Do we care that their statistics are negative? Why not just & lt; Compare 0? #if ch1skl & lt; 0: # ch1skl = 0 #if ch2skl & lt; 0: # ch2skl = 0 #if ch1str & lt; 0: # ch1str = 0 #if ch2str & lt; 0: # ch2str = 0 If ch1str & lt; 0: print (CharacterOne + is "dead now") if ch2str & lt; 0: print (CharacterTwo + "is dead now") # Do you want the winner to be randomly determined? Currently there is no effect on the winner of your statistics if play1 == true: print (Characteron + "won this round, is now", "1", "power" and ", ch1skl," skill ") print (character) Two + "has lost this round, is now", "power" and ", ch2str," skill ") other: print (Characters" four + won in this round, now ", ch2str," power and ", Ch2skl, "skill") print (characteron + "has lost this round, is now", ch1str, "power and", ch1skl, "skill")


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -