-
Notifications
You must be signed in to change notification settings - Fork 50
rost code review #46
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?
rost code review #46
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,8 @@ | ||
| """ | ||
| Якщо елемент списку - ще один список вивести його на єкран | ||
| """ | ||
| a = ['g', 'f', ['f','g',], ['k','l'], 'o', 3 ,True] | ||
| for i in a: | ||
| c= enumerate(i, list )#команда, яка перевіряє тип даних | ||
| if c==1: | ||
| print(i) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| """ | ||
| Заданий рядок. Вивести сумму всих цифр | ||
| """ | ||
| a = ('dsad486feaf8egjytj4jytj66') | ||
|
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. All right. It's your code in function |
||
| c=0 | ||
| for i in a: | ||
| if i in '0123456789': | ||
| c+=int(i) | ||
| print(c) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """ | ||
| Заданий рядок. Вивести рядок з кожною другою літерою у верхньому регістрі | ||
| """ | ||
| a = ('Rost can\'t deal whith it') | ||
| b = len(a) | ||
| print(a.upper(b)) | ||
|
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. Here you should create for-loop and use slice-method for lists, so in each interval it'll be letter in upper register. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| """ | ||
| Користувач воодить речення на англійській мові, розділяючи слова пробілами. Вивести список, кожний елемент якого є списком, де | ||
| перший елемент - кожне друге слово речення, а другий кількість повторів цьогого слова у реченні. | ||
| """ | ||
| import re | ||
| def find_text(text): | ||
| n= re.split(' ',text) | ||
|
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. Nice, and some mentions for you. |
||
| fin=[] | ||
| for i in n: | ||
| b=re.findall('[A-Za-z]{1,}',i) | ||
| if b =='': | ||
| b=' ' | ||
| fin.append(b[0]) | ||
| print(b) | ||
| fin1=[] | ||
| for i in fin[::2]: | ||
| k=0 | ||
| k=len(re.findall(str(i),str(fin))) | ||
| fin1.append([i,k]) | ||
| return fin1 | ||
| a= find_text(input()) | ||
| print(a) | ||
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.
Here should be a command isinstance(i,list)
c= enumerate(i, list )