This file contains hidden or 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
| # Outputs a plain-text formatted explicity declared Powershell array from a new-line separated list of items that is pasted or manually typed by the user. | |
| # Written in Python 3.6.2. | |
| # [email protected] | |
| items = [] | |
| userinput = input("Please enter the first list item: ") | |
| items.append(userinput) | |
| i = 2 |
This file contains hidden or 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
| """ | |
| --- Battleship --- | |
| Make multiple battleships: you'll need to be careful because you need to make sure that you don’t place battleships on top of each other on the game board. You'll also want to make sure that you balance the size of the board with the number of ships so the game is still challenging and fun to play. | |
| Make battleships of different sizes: this is trickier than it sounds. All the parts of the battleship need to be vertically or horizontally touching and you’ll need to make sure you don’t accidentally place part of a ship off the side of the board. | |
| Make your game a two-player game. |
This file contains hidden or 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
| """ | |
| This is a game of Rock, Paper, Scissors against the computer! | |
| """ | |
| from random import randint | |
| from time import sleep | |
| options = ["R", "P", "S"] | |
| LOSE_MESSAGE = "Sorry, better luck next time!\n" |
This file contains hidden or 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
| """This program will allow a user to attempt to guess a randomly generated number.""" | |
| from random import randint | |
| from time import sleep | |
| def get_user_guess(): | |
| user_guess = int(raw_input("What's your whole-number guess? ")) | |
| return user_guess | |
NewerOlder