-
Notifications
You must be signed in to change notification settings - Fork 50
ready_to_review #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ready_to_review #51
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| """" | ||
| Дано список. | ||
| Вивести кількість елементів списку типу string | ||
| """ | ||
|
|
||
| list1 = list(input('список=')) | ||
| k = 0 | ||
| if isinstance(list1[k], str): | ||
| k += 1 | ||
| print(k) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| """ | ||
| Дано текст. | ||
| Видалити елементи значення integer | ||
| """ | ||
|
|
||
| text1 = str(input('text:')) | ||
| list1 = ','.join(list(text1)) | ||
| n = 0 | ||
| if isinstance(list1[n], int): | ||
| list1.remove(str) | ||
| n += 1 | ||
| print (list1) | ||
|
Comment on lines
+6
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. list_text = [32434.332, 'dssd', 32234, '3234'] |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| """ | ||
| Дано текст. | ||
| Перші літери перевести у верхній регістр, а решту - в нижній. | ||
| """ | ||
|
|
||
| import string | ||
| text1 = list(input('Введіть текст:')) | ||
| text2 = text1 | ||
| print(text2) | ||
|
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Програма не виконує поставлене завдання. Виконання завдання слід реалізувати так: Tim Dorotyuk, [24.12.19 01:23] |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| """ | ||
| Написати валідатор для вводу та виводу даних на мові програмування Паскаль | ||
| """ | ||
|
|
||
| import re | ||
| def validator (): | ||
| text = input('Введіть дані:') | ||
| if bool(re.compile('^(Begin){1}\\n writeln{0,+}readln{0,+}(Begin){0,1} writeln{0,+}readln{0,+} end{0,1}\\n end{1}$',text)): | ||
| print ('Yes') | ||
| else: | ||
| print ('no') | ||
| validator() | ||
|
|
||
| flag = input('для запуску програми натисніть \"Enter\", щою завершити програми \"n\"') | ||
| if flag != 'n': | ||
| validator() | ||
| flag = input('для запуску програми натисніть \"Enter\", щою завершити програми \"n\"') | ||
| else: | ||
| print('Допобачення') | ||
|
Comment on lines
+5
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Для того, аби програма нормально працювала, слід переписати регулярний вираз, а такжо замінити compile на match. Після цих змін програма має виглядати наступним чином: import re flag = input('для запуску програми натисніть "Enter", щою завершити програми "n"') |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
оскільки список дано, то використання функціїї введення користувачем input() не є коректним. Поставлену задачу краще виконати так:
list1 = [65, True, 67.87, 'cola', 'pepsi', 34, 'what']
str_count = 0
for element in list1:
if isinstance(element, str):
str_count+=1
print('Кількість елементів списку типу string: ', str_count)