Skip to content

Instantly share code, notes, and snippets.

View rostyq's full-sized avatar
🇺🇦
remember: russia is a terrorist state

Rostyslav Bohomaz rostyq

🇺🇦
remember: russia is a terrorist state
View GitHub Profile
import numpy
def rnd_list():
size_of_list = numpy.random.randint(10, 20)
return numpy.random.randint(0, 100, size_of_list)
def rm_duplicates_1(lst):
return list(set(lst))
def get_user_int(msg):
'''
Return integer from user.
:param msg:
:return user_input:
'''
user_input = input(msg)
try:
user_input = int(user_input)
except:
def get_list_ends(input_list):
"""
Return the first and last item of list.
:param input_list:
:return list_ends:
"""
return [input_list[0], input_list[-1]]
a = [5, 10, 15, 20, 25]
def get_user_int(msg):
'''
Return integer from user.
:param msg:
:return user_input:
'''
user_input = input(msg)
try:
user_input = int(user_input)
except:
import numpy
def rnd():
return numpy.random.randint(0, 100, numpy.random.randint(10, 30))
a, b = rnd(), rnd()
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
import random
def new():
global num, count
num = random.randint(1, 9)
count = 0
too = [8, 7, 6, 5]
close = [4, 3, 2, 1]
from pandas import DataFrame
rules = "\n'r' for 'rock;\n'p' for 'paper';\n's' for 'scissors'."
pick = ['r', 'p', 's']
m = DataFrame([[None, True, False], [False, None, True], [True, False, None]],
columns=pick,
index=pick)
print("Rock-Paper-Scissors Game!\n"+rules)
while True:
one = input("Player one: ")
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
b = [i for i in a if i % 2 == 0]
print(b)
while True:
something = input('Input text("exit" to break): ')
if something == 'exit':
break
# exceptions
restricted_symbols = [' ', '!', '.',
'?', ',', '_',
'$', '#', '@',
import numpy
def rnd():
return numpy.random.randint(0, 100, numpy.random.randint(10, 20))
a, b = rnd(), rnd()
c = [i for i in a if i in b]
print("First array: {0}\nSecond array: {1}\nArray of common items: {2}".format(a, b, c))