Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

INSTRUKCJE WARUNKOWE

OD GÓRY DO DOŁU KAŻDY KOLEJNY WPIS TO KOELJNE ZADANIE

max = input[0]
for i in input:
if(i > max):
max = i
print(max)

min = input[0]
for i in input:
if(i < min):
min = 1
print(min)

max = input[0]
for i in input:
if(i > 10):
print(i)

for i in input:
if(i < 0):
print(i)

for i in input:
if(i % 5 == 0):
print(i)

for i in input:
if len(i) > 5:
print(True)
else:
print(False)

for i in input:
if i.isupper():
print("True")
else:
print("False")
for i in input:
if len(i) % 2 == 0:
print(i)

for s in input:
numbers = s.split()
first = int(numbers[0])
second = int(numbers[1])
if(first > second):
print(first)
else:
print(second)

for i in input:
if "f" in i:
print("True")
else:
print("False")

for i in input:
if "one" in i:
print("True")
else:
print("False")

for i in input:
if ' ' in i:
print("True")
else:
print("False")
list = []
for i in input:
if "p" not in i and "b" not in i:
list.append(i)
print(list)

for i in range(input[0]):
if(i == 0 or i == 1):
continue

is_prime = True
for j in range(2, i):
if(i % j == 0):
is_prime = False
break
if(is_prime == True):
print(i)

for i in input:
number = int(i)
is_prime = True
if(number <= 1):
print(False)
else:
for i in range(2, number):
if(number % i == 0):
is_prime = False
break
if(is_prime == True):
print(True)
else:
print(False)

for i in input:
start1 = int(i.split()[0])
end1 = int(i.split()[1])
start2 = int(i.split()[2])
end2 = int(i.split()[3])

if (end1 >= start2) and (end2 >= start1):


print(True)
else:
print(False)

for i in input:
new, row = "", 1

for j in range(1, len(i)):


if i[j] != i[j - 1] or j == len(i) - 1:
if j == len(i) - 1:
row += 1

if row > 2:
new += i[j - 1] + str(row)
elif row == 2:
new += i[j - 1] + i[j - 1]
else:
new += i[j-1]

row = 1
else:
row += 1
print(new)

for i in input:
numbers = i.split()

sum = 0

for j in numbers:
sum += int(j)

avg = float(sum) / len(numbers)

index = 0

for j in numbers:
if abs(int(j) - avg) < abs(int(numbers[index]) - avg):
index = numbers.index(j)
print(numbers[index])

smax = ''
max = 0
for s in input:
c=0
for i in s:
if(i == 'a'):
c += 1
if(c >= max):
max = c
smax = s
print(smax)

for i in range(1, int(input[0] / 2 + 1)):


if input[0] % i == 0:
print(i)
print(input[0])

smax= ''
max= 0
for s in input:
c=0
for i in s:
if(i == 'a'):
c += 1
if( c > max):
max = c
smax = s
print(smax)

You might also like