creating dictionaries.py

This commit is contained in:
Yesen 2023-10-04 17:12:15 +03:00
parent 7011c955a4
commit a2471ac34e
5 changed files with 37 additions and 8 deletions

6
practica/math/sum.py Normal file
View File

@ -0,0 +1,6 @@
# сумма для целых чисел
S= 0
for i in input().split():
i = int(i)
S += i
print(S)

View 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)

View File

@ -34,11 +34,11 @@
# print(i * n, end="\t")
# print()
# # процентное соотношение
S = input().lower()
S= 0
# for i in range(len(a)+1):
for i in input().split():
i = int(i)
S += i
# print(S)
print(S)
g = S.count("g")
print (g)
c = S.count("c")
print (g)
print (((int(g)+int(c))/len(S))*100)

View File

@ -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)