Compare commits

...

4 Commits

Author SHA1 Message Date
8cb343b26f SMIL 2023-07-02 20:56:45 +02:00
523d14fefb Alphabet Spam 2023-07-02 20:48:06 +02:00
3f3718d093 Ghost Leg 2023-07-02 20:30:12 +02:00
edde2f011b Oddities 2023-07-02 20:12:05 +02:00
4 changed files with 47 additions and 0 deletions

21
alphabetspam.py Normal file
View File

@@ -0,0 +1,21 @@
s = input()
uppercase = 0
lowercase = 0
whitespace = 0
specials = 0
for c in s:
if c == "_":
whitespace += 1
elif 65 <= ord(c) <= 90:
uppercase += 1
elif 97 <= ord(c) <= 122:
lowercase += 1
else:
specials += 1
total = len(s)
print(f"{whitespace/total:.10f}")
print(f"{lowercase/total:.10f}")
print(f"{uppercase/total:.10f}")
print(f"{specials/total:.10f}")

15
ghostleg.py Normal file
View File

@@ -0,0 +1,15 @@
n, m = map(int, input().split())
rungs = [int(input()) for _ in range(m)]
res = [
0,
] * n
for element in range(1, n + 1):
pos = element
for r in rungs:
if pos == r:
pos += 1
elif pos == r + 1:
pos -= 1
res[pos - 1] = element
print("\n".join(map(str, res)))

4
oddities.py Normal file
View File

@@ -0,0 +1,4 @@
n = int(input())
for _ in range(n):
x = int(input())
print(f"{x} is {'even' if x % 2 == 0 else 'odd'}")

7
smil.py Normal file
View File

@@ -0,0 +1,7 @@
s = input()
for i in range(len(s) - 1):
if s[i : i + 2] in [":)", ";)"]:
print(i)
elif i + 2 <= len(s) and s[i : i + 3] in [":-)", ";-)"]:
print(i)