Generative AI Still Has Trouble With Negation

+ Email Marketing Courses and News

This week we’re talking about generative AI, email marketing, and programming projects. We’re also including a few of this week’s latest job opportunities and a poll.

This Week’s Reads

Finding this email helpful? Please consider sharing it!

Why Email Marketing is Essential

Whether you’re looking to upskill at your current position or find a new job this year, it’s important to consider email marketing as a vital tool.

More than three quarters agree on this tool.

According to our research, more than three-quarters of professionals at small and mid-size organizations rely on email marketing to acquire and retain customers.

That’s absolutely vital.

It’s also why we asked an expert to evaluate all the best email marketing courses of the year. This includes free resources as well as paid programs.

This Week’s Jobs

Python Project: Password Strength Checker

One of our favorite resources at Hackr.io is our Python projects. And readers in previous weeks have requested more code.

So we’re including the full code for one of our most popular Python projects. Here’s the code for our password strength checker project.

'''
Password Strength Checker
-------------------------------------------------------------
'''


import string
import getpass


def check_password_strength():
   password = getpass.getpass('Enter the password: ')
   strength = 0
   remarks = ''
   lower_count = upper_count = num_count = wspace_count = special_count = 0

   for char in list(password):
       if char in string.ascii_lowercase:
           lower_count += 1
       elif char in string.ascii_uppercase:
           upper_count += 1
       elif char in string.digits:
           num_count += 1
       elif char == ' ':
           wspace_count += 1
       else:
           special_count += 1

   if lower_count >= 1:
       strength += 1
   if upper_count >= 1:
       strength += 1
   if num_count >= 1:
       strength += 1
   if wspace_count >= 1:
       strength += 1
   if special_count >= 1:
       strength += 1

   if strength == 1:
       remarks = ('That\'s a very bad password.'
           ' Change it as soon as possible.')
   elif strength == 2:
       remarks = ('That\'s a weak password.'
           ' You should consider using a tougher password.')
   elif strength == 3:
       remarks = 'Your password is okay, but it can be improved.'
   elif strength == 4:
       remarks = ('Your password is hard to guess.'
           ' But you could make it even more secure.')
   elif strength == 5:
       remarks = ('Now that\'s one hell of a strong password!!!'
           ' Hackers don\'t have a chance guessing that password!')

   print('Your password has:-')
   print(f'{lower_count} lowercase letters')
   print(f'{upper_count} uppercase letters')
   print(f'{num_count} digits')
   print(f'{wspace_count} whitespaces')
   print(f'{special_count} special characters')
   print(f'Password Score: {strength / 5}')
   print(f'Remarks: {remarks}')


def check_pwd(another_pw=False):
   valid = False
   if another_pw:
       choice = input(
           'Do you want to check another password\'s strength (y/n) : ')
   else:
       choice = input(
           'Do you want to check your password\'s strength (y/n) : ')

   while not valid:
       if choice.lower() == 'y':
           return True
       elif choice.lower() == 'n':
           print('Exiting...')
           return False
       else:
           print('Invalid input...please try again. \n')


if __name__ == '__main__':
   print('===== Welcome to Password Strength Checker =====')
   check_pw = check_pwd()
   while check_pw:
       check_password_strength()
       check_pw = check_pwd(True)

Looking for more? We’ve got dozens of projects.

The Problem of Negation in Prompt Engineering

If you’ve spent any time with OpenAI’s suite of products or any of the many AI image generators, you’ll already know there’s an art to prompt engineering.

Here’s something you may not have realized: Generative AI still has trouble with negation.

Don't say don't when prompt engineering.

If your prompts include “don’t” or “avoid”, you might find the results include exactly the opposite of what you asked!

Looking to master AI outputs?

Rate this Newsletter

The team at Hackr.io aims to provide the best information possible. Please let us know how we're doing!

Login or Subscribe to participate in polls.