Reputation: 25
So I have:
Num = random.randint(1,100)
Print(Num)
Num - 20
Print(Num)
And I want it to print the original rand number - 20, how wold I do this?
Upvotes: 0
Views: 35
Reputation: 2490
@MrGeek is right. @ScottPickslay, just saying Num - 20 will calculate the answer you're looking for but you are not using that answer. By saying Num = num - 20, you are storing the answer of Num -20 back into Num.
Num = random.randint(1,100)
Print(Num) # Lets say this outputs the number 57
Num = Num - 20
Print(Num) # Then this will now be 37
Upvotes: 1
Reputation: 22776
Store the result of subtraction back to Num
, don't just calculate it:
Num = Num - 20
Or:
Num -= 20
Upvotes: 0