This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ## Initializes a request | |
mysock.connect(('data.pr4e.org',80)) # connects to the request | |
cmd = 'GET http://data.pr4e.org/intro-short.txt HTTP/1.0\r\n\r\n'.encode() # Gets the metadata from the HTTP host and encodes it too. | |
mysock.send(cmd) # Finally sends it | |
while True: | |
data = mysock.recv(512) # recives 512 characters only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amountRequired = 150 # <---can be changed to desired user input. | |
amountReturned = 0 | |
counter_25 = 0 | |
counter_10 = 0 | |
counter_5 = 0 | |
counter_1 = 0 | |
while amountRequired >= 25: | |
amountRequired -= 25 | |
counter_25 += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#The token is provided by the player as an input | |
token = eval(input("Enter Your Token Please: ")) # Evaluating the incoming value to its respective Data type | |
print(f"Tokens: {token}\n") | |
trackToken = token #assigning the tracking variable of token | |
counter = 0 #starting value --> 0 | |
#using whileloop | |
while counter < token: | |
trackToken = trackToken - 1 #subtracting the Token by 1 figure | |
print(f"| Playing, Chances Left: {trackToken} |") |