creating dictionaries.py
This commit is contained in:
parent
7011c955a4
commit
a2471ac34e
6
practica/math/sum.py
Normal file
6
practica/math/sum.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# сумма для целых чисел
|
||||||
|
S= 0
|
||||||
|
for i in input().split():
|
||||||
|
i = int(i)
|
||||||
|
S += i
|
||||||
|
print(S)
|
0
practica/stepik/beneficial_features/dictionaries.py
Normal file
0
practica/stepik/beneficial_features/dictionaries.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
s = 'abcdefghijk'
|
||||||
|
m = s[3:6]
|
||||||
|
print (m)
|
||||||
|
m = s[:6]
|
||||||
|
print (m)
|
||||||
|
m = s[3:]
|
||||||
|
print (m)
|
||||||
|
m = s[::-1]
|
||||||
|
print (m)
|
||||||
|
m = s[-3:]
|
||||||
|
print (m)
|
||||||
|
m = s[:-6]
|
||||||
|
print (m)
|
||||||
|
m = s[-1:-10:-2]
|
||||||
|
print (m)
|
@ -34,11 +34,11 @@
|
|||||||
# print(i * n, end="\t")
|
# print(i * n, end="\t")
|
||||||
# print()
|
# print()
|
||||||
|
|
||||||
# # процентное соотношение
|
S= 0
|
||||||
S = input().lower()
|
# for i in range(len(a)+1):
|
||||||
|
for i in input().split():
|
||||||
|
i = int(i)
|
||||||
|
S += i
|
||||||
|
# print(S)
|
||||||
print(S)
|
print(S)
|
||||||
g = S.count("g")
|
|
||||||
print (g)
|
|
||||||
c = S.count("c")
|
|
||||||
print (g)
|
|
||||||
print (((int(g)+int(c))/len(S))*100)
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
# процентное соотношение букв в строке
|
||||||
|
S = input().lower()
|
||||||
|
print (S)
|
||||||
|
g = S.count("g")
|
||||||
|
print (g)
|
||||||
|
c = S.count("c")
|
||||||
|
print (g)
|
||||||
|
print (((int(g)+int(c))/len(S))*100)
|
Loading…
Reference in New Issue
Block a user