Skip to content

Conversation

@nogirosta
Copy link

No description provided.

Copy link

@juli-nagy juli-nagy left a 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 )#команда, яка перевіряє тип даних

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

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

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)

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants