-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
juli-nagy
left a comment
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.
WELL-DONE
| """ | ||
| a = ['g', 'f', ['f','g',], ['k','l'], 'o', 3 ,True] | ||
| for i in a: | ||
| c= enumerate(i, list )#команда, яка перевіряє тип даних |
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 )
| """ | ||
| Заданий рядок. Вивести сумму всих цифр | ||
| """ | ||
| a = ('dsad486feaf8egjytj4jytj66') |
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.
All right. It's your code in function
def sum_of_digits(a): a = ('dsad486feaf8egjytj4jytj66') c=0 for i in a: if i in '0123456789': c+=int(i) print(c)
| """ | ||
| a = ('Rost can\'t deal whith it') | ||
| b = len(a) | ||
| print(a.upper(b)) No newline at end of file |
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 you should create for-loop and use slice-method for lists, so in each interval it'll be letter in upper register.
Use upper()
a = 'Rost can\'t deal whith it' b = len(a) new_list=[] for i in range (b): if i%2==0: a=a[:i]+a[i].upper()+a[i+1:] print(a)
| """ | ||
| import re | ||
| def find_text(text): | ||
| n= re.split(' ',text) |
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.
Nice, and some mentions for you.
You can use fin = re.findall('\w+', text) here instead of n= re.split(' ',text), so that all for-loop above could be removed
fin=[] for i in n: b=re.findall('[A-Za-z]{1,}',i) if b =='': b=' ' fin.append(b[0]) print(b)
No description provided.