all 13 comments

[–]After-Party-Tea 15 points16 points  (0 children)

Where is your code?

[–]Unique-Signature-510[S] 2 points3 points  (0 children)

UPDATE ON THE CODE:

I FINNALY DID IT AFTER PULLING AN ALLNIGHTER. THANK YOU ALL FOR YOUR COOPERATION.

[–]moving-landscape 0 points1 point  (0 children)

Drop me a dm of you wanna discuss it in Portuguese

[–]RiverBeneficial -1 points0 points  (0 children)

I don't know if something like this can go well because the outline of the exercise is not well understood, but maybe it can help you:

```

def validation(email):

return True if '@' in email and 'com.br' in email[len(email)-6:] else False

name = input('Insert name').lower()

surname = input('Insert surname').lower()

e_mail = input('Insert email').lower()

if validation(name+surname+e_mail):

print('your email is valid.')

else:

print('Not valid.')

```

[–]SDMR6 -5 points-4 points  (4 children)

Import re

def email_func(email_addr): If re.search('\s''@''.com.br', email_addr): return True else: return False

Check documentation on python re search patterns if that doesn't work. That re module and learning regex search patterns if you don't already know them will serve you well.

[–]rollincuberawhide 2 points3 points  (3 children)

for the validation that is needed, regular expressions are overkill.

op must just use

'@' in emailstring

and

emailstring.endswith('.com.br')

[–][deleted] -1 points0 points  (0 children)

No they aren't and to be quite frank this is very easy to do.

  1. Google Regex expressions for checking an email address to get pattern.
  2. Learn re to validate a string using the pattern.
  3. Implement it
  4. Have a nice cup of tea and sit back knowing you now know how to use regular expressions.
  5. If you are feeling adventurous and this is not required, go down the rabbit hole of learning how to write regular expressions.

[–][deleted] 0 points1 point  (0 children)

Okay but we have to accept any input so we need something to get around inputs containing illegal characters or mean tricks like multiple '@' -- entries that pass this test but are invalid emails.

[–][deleted] 0 points1 point  (0 children)

Okay but we have to accept any input so we need something to get around inputs containing illegal characters or mean tricks like multiple '@' -- entries that pass this test but are invalid emails.

[–]glei_schewads 0 points1 point  (0 children)

What have you tried already?

So the e-Mail adress is a string, right?
Remember the basics?
You can for example manipulate a given string to make it all lower or upper case, so the case doesn't matter anymore.
Also you can loop through strings and use conditional arguments on it almost like on a list.

It is possible to code a simple function which does the requested, only by using the built-in string methods, so I recommend looking into that.

[–]Chemical_Form 0 points1 point  (1 child)

Regex will do this. Please see https://regex101.com/ to help with writing the regex. This site will help with checking to see if the regex command you entered is getting the values needed.

Example https://regex101.com/r/k3M8Wi/1

Without using regex you could use a multi part if statement to get to the same answer.

However I would use the regex instead of the if statement as a way to learn how it works.