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
from time import strftime
now = int(strftime("%Y"))
name = input("What is your name?\n->")
years = list(range(100))
while True:
try:
age = int(input("How old are you?\n->"))
if age not in years:
while True:
try:
check = input("Input a natural number.\n->")
if check == 'exit': break
num = input("Input a divider.\n->")
if num == 'exit': break
check = int(check)
num = int(num)
if check % 4 == 0:
print("{0} is multiple of 4.".format(check))
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
num = input('Input a number: ')
num = int(num)
b = [i for i in a if i < num]
print(b)
num = input("Input a number: ")
num = int(num)
rng = range(1,num+1)
new_rng = [i for i in rng if num % i ==0]
print(new_rng)
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))
while True:
something = input('Input text("exit" to break): ')
if something == 'exit':
break
# exceptions
restricted_symbols = [' ', '!', '.',
'?', ',', '_',
'$', '#', '@',
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
b = [i for i in a if i % 2 == 0]
print(b)
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: ")
import random
def new():
global num, count
num = random.randint(1, 9)
count = 0
too = [8, 7, 6, 5]
close = [4, 3, 2, 1]
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]