Really Need Help with a Python problem <3

Status
This thread has been locked.

Distinguished

Banned
Feedback score
7
Posts
277
Reactions
142
Resources
0
Hey guys, basically I need help with a problem. I am making a very simple and easy(no graphics) snakes and ladders game in python. To start out I know it is very inefficient but I just want to get the jist of things.

Problem: When one player hits 100 I want the program to terminate and shut off.

Part of program:

if Player 1> 100:
print('Player1 Wins!')
if Player2> 100:
print('Player2Wins')
 
Banned forever. Reason: Admitted to Scamming
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Raine

Java Developer
Supreme
Feedback score
1
Posts
6
Reactions
6
Resources
0
Code:
if Player1 >= 100:
    print('Player1 Wins!')
    exit(0) # Just simply run exit(0) inside your code like so
if Player2 >= 100:
    print('Player2 Wins')
    exit(0)

If you want your code to stop when either score is greater than or equal to 100, use this snippet inside your main loop!
 
Last edited:

Distinguished

Banned
Feedback score
7
Posts
277
Reactions
142
Resources
0
Code:
if Player1 >= 100:
    print('Player1 Wins!')
    exit(0) # Just simply run exit(0) inside your code like so
if Player2 >= 100:
    print('Player2 Wins')
    exit(0)

If you want your code to stop when either score is greater than or equal to 100, use this snippet inside your main loop!
Thank you
 
Banned forever. Reason: Admitted to Scamming
Status
This thread has been locked.
Top