[SOLVED] Why do I get a None output when I use this if statement

Issue

This Content is from Stack Overflow. Question asked by Grak

P1_MS = input("Type a letter to begin player 1 and roll dice")
if P1_MS == Alph or Num :
         P1_S =P1_S+D1+D2 , print("First roll is", D1) , print("Second roll is", D2)
         print (P1_S,"is the total amount")

Output:

First roll is 3
Second roll is 3
(6, None, None) is the total amount

How can I remove the none none at the end of the output.



Solution

You haven’t mentioned what is P1_S in your code, or where you have declared it. I guess you have made it a list or some other datatype than simple Int. Check it.


This Question was asked in StackOverflow by Grak and Answered by Priyankar Koley It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?