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
a = int(input("Enter the length you want the game board to be: ")) | |
b = int(input("Enter the width you want the game board to be: ")) | |
for x in range(0, a): | |
print(" ---" * b) | |
print("| " * (b+1)) | |
print(" ---" * b) |
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
user_input = input("Enter a list of numbers from least to greatest over here: ") | |
user_input_2 = input("Enter the number you want to check to see if it's in the above list over here: ") | |
if user_input_2 in user_input: | |
print("This number is in the list you entered.") | |
if user_input_2 not in user_input: | |
print("This number is not in the list you entered.") |
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
from random import randrange | |
from time import sleep | |
def cows_and_bulls_game_2(): | |
a = randrange(1, 9) | |
b = randrange(1, 9) | |
c = randrange(1, 9) | |
d = randrange(1, 9) | |
print("This program runs the cows ands bulls game where a four-digit number is generated every time you play.") |
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
def word_reversal_function(): | |
user_input = raw_input("Enter a list of words over here: ") | |
broken_input = user_input.split(" ") | |
print(" ".join(broken_input[::-1])) | |
word_reversal_function() |
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
class Student: | |
name = 0 | |
age = 0 | |
role_number = 0 | |
math_marks = 0 | |
english_marks = 0 | |
science_marks = 0 | |
def __init__(self): | |
pass |
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
class Cost: | |
time = 0 | |
sea = 0 | |
pool = 0 | |
umbrella = 0 | |
table = 0 | |
cost = 0 | |
def __init__(self): | |
pass |
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
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 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 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 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': |
NewerOlder