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
def game(): | |
def actual_game(): | |
import random | |
print("This is a guessing game. If you want to exit the game at any time, type exit surrounded by quotes.") | |
print("The computer has generate a random integer between 1 and 9 and including 1 and 9.") | |
number = random.randint(1, 9) | |
guess = 0 | |
count = 0 | |
while guess != number and guess != "exit": |
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
def game(): | |
player_1 = input("Enter your choice over here player 1 ('rock', 'paper', or 'scissors'): ") | |
if player_1 != "rock": | |
if player_1 != "paper": | |
if player_1 != "scissors": | |
print("You have not entered a valid choice. Please start the game again.") | |
return | |
for i in range(0, 1000000): | |
if i == 984353: | |
print("Didn't I say no cheating!!! You can't see it anyways, so scroll down and continue playing fairly!!!") |
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
a = list(input("Enter a list of numbers here (in the format of x, y, z): ")) | |
my_list = [] | |
for b in a: | |
if float(b / 2.0) == b // 2.0: | |
my_list.append(b) | |
if float(b / 2.0) != b // 2.0: | |
pass | |
print(my_list) |
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
user_number = input("Enter an integer over here and the program will print out a list of all of its divisors: ") | |
x = range(1, user_number) | |
for y in x: | |
if (user_number / float(y)) == float(user_number//y): | |
print(y) | |
else: | |
pass |
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
a = str(input("Enter letters or words over here that are surrounded by quotes, and the program checks if palindrome: ")) | |
reverse_a = a[::-1] | |
if a == reverse_a: | |
print("This is a palindrome.") | |
else: | |
print("This is not a palindrome.") |
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
user_list = input("Enter your list of numbers here (separate each with a comma e.g. 1, 2, 3, 4, 5, 6): ") | |
y = input("Enter a number here and the program will print all of the numbers in your list less than this number: ") | |
def check(): | |
if x < y: | |
print(x), | |
for x in user_list: |
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
def practice_2(): | |
number = int(input("Enter an integer over here: ")) | |
if type(number) == float: | |
print("You have not entered an integer. Please try again and enter a valid number.") | |
return | |
if float(number/2.0) == number//2.0: | |
print("The number you entered is even.") | |
if float(number/2.0) != number//2.0: | |
print("The number you entered is odd.") |
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
name = str(input("Please enter your name over here (in the format of your name surrounded by quotation marks): ")) | |
age = int(input("Please enter the age that you will turn on your birthday this year if it has not passed already: ")) | |
date_of_birth = 2020-age | |
print("The year that you will turn 100 years old in is " + str(date_of_birth+100) + ".") |
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
import time | |
x = time.time() | |
y = time.time() | |
count_of_seconds_passed = 0 | |
print("Below you will see a count of how many seconds have passed since the Epoch which was January 1st, 1970.") | |
time.sleep(3) | |
print("After that you will see how many seconds have passed since the program started displaying the time since Epoch.") | |
time.sleep(3) | |
print(str(count_of_seconds_passed) + " seconds passed since start time") | |
while x < y: |
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
class Cost: | |
def __init__(self, time, sea, pool, umbrella, table, total_cost): | |
self.time = time | |
self.sea = sea | |
self.pool = pool | |
self.umbrella = umbrella | |
self.table = table | |
self.total_cost = total_cost | |