Skip to content

Instantly share code, notes, and snippets.

View reloadedd's full-sized avatar
💭
Stackin' up

ʀᴇʟᴏᴀᴅᴇᴅᴅ ⌞⌯⌝ reloadedd

💭
Stackin' up
View GitHub Profile
#!/usr/bin/env python3
import random
MAX_ELEMENT_VALUE = 100
MAX_ELEMENTS = 20
# Randomly generate two lists
# Noob way
#!/usr/bin/env python3
import random
number = random.randint(1, 9)
guesses = 0
user_input = input('Enter a number (between 1 and 9) [>>>] ')
while user_input != 'exit':
if int(user_input) < number:
#!/usr/bin/env python3
choices = 'rock', 'paper', 'scissors'
EQUALITY = "Oh, no! There is no winner, it's equality!"
PLAYER_ONE_WINNER = '...And the winner is: ~Player One~'
PLAYER_TWO_WINNER = '...And the winner is: ~Player Two~'
print('''Welcome to the "Rock, Paper and Scissors" Game!
The rules are simple:
1. Each player chooses what he/she wants from the following list: rock, \
#!/usr/bin/env python3
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
new_list = [element for element in a if element % 2 == 0]
print(new_list)
#!/usr/bin/env python3
string = list(input("Please enter a string > "))
reverse_string = string.copy()
reverse_string.reverse()
if string == reverse_string:
print("Palindrome.")
else:
print("Not palindrome.")
#!/usr/bin/env python3
import random
def return_common_elements(first_list, second_list):
first_list.extend(second_list)
new_list = list(set(first_list))
return new_list
#!/usr/bin/env python3
def get_divisors(n):
d = 1
while d * d <= n:
if n % d == 0:
print(d)
# If d is a divisor, then number / d is also a divisor
# But we need to be careful with square numbers
#!/usr/bin/env python3
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# Print all elements that are less than 5
for i in a:
if i < 5:
print(i)
print()
# Make a new list with the elements less than 5
#!/usr/bin/env python3
number = int(input("Please enter a number > "))
remainder = number % 2
if remainder:
print("It's seems that {0} is odd.".format(number))
else:
print("It's seems that {0} is even.".format(number))
#!/usr/bin/env python3
import datetime
name = input("Please enter your name here > ")
age = int(input("Please enter your age here > "))
difference = 100 - age
current_year = datetime.datetime.now().year
string = "{0}, the year you will turn 100 will be {1}".format(name, current_year + difference)