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_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 = 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
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
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 prime_number(): | |
print("This program determines if a number is prime or not.") | |
print("This program will only accept integers.") | |
number = input("Please enter the number you want to check over here: ") | |
number = int(number) | |
if number > 0: | |
if number == 3: | |
print("The number is prime.") | |
choice = input("Do you want to enter another number? Type 'continue' if you do & 'exit' if you don't: ") | |
if choice == 'continue': |
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 | |
def practice_12(): | |
a = list(input("Enter a list of numbers separated by commas over here: ")) | |
time.sleep(1) | |
print("The program will print the first and last numbers of your list.") | |
time.sleep(1) | |
print(a[::len(a)-1]) | |
practice_12() |
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 fibonacci(): | |
num = int(input("Enter how many numbers from the fibonacci sequence you would like to generate: ")) | |
i = 1 | |
if num == 0: | |
fib = [] | |
return fib | |
elif num == 1: | |
fib = [1] | |
return fib | |
elif num == 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
def loop_and_constructing_list_solution(): | |
user_input = input("Enter a list of numbers separated by a comma (x, y, z) over here: ") | |
my_list = [] | |
for i in user_input: | |
if i in my_list: | |
continue | |
my_list.append(i) | |
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
class Cost: | |
time = 0 | |
sea = 0 | |
pool = 0 | |
umbrella = 0 | |
table = 0 | |
cost = 0 | |
def __init__(self): | |
pass |