Generating an adequate password

Python 3, 69 bytes

lambda a,b,*c:b[0].upper()+"@"+a[2:]+c[b[0]in"bcdfghjklmnpqrstvwxyz"]

Try it online!


05AB1E, 22 20 18 bytes

н©u'@I¦¦žN®åiI\}IJ

Input taken as b,a,c,d

Try it online!

Explanation (outdated)

¦                     # remove the first char of a
 s                    # swap b to the top of the stack
  н©                  # push the head of b and store a copy in register
    uì                # convert the head to upper case and prepend to a
      U               # store in variable X
       žN®åi          # if the head of b is a consonant
            \}        # discard c
              X«      # concatenate X with c or d
                '@1ǝ  # insert an "@" at character position 1

used in the link as н isn't pulled to TIO yet.


Jelly, 17 bytes

Ḣ©Œu;”@o;⁶⁵®eØC¤?

A full program, taking the arguments in the order b, a, c, d.

Try it online!

How?

The main link is dyadic, taking b and a, the program inputs are then b, a, c, and d (the 3rd through sixth command line arguments), so c and d are accessed as such.

Ḣ©Œu;”@o;⁶⁵®eØC¤?  Main link: b, a           e.g. "gmail", "volvo" (c="5555" and d="0001")
Ḣ                  head b                         'g'
 ©                 copy to register and yield     'g'
  Œu               convert to uppercase           "G"
     ”@            literal '@' character          '@'
    ;              concatenate                    "G@"
       o           logical or with a (vectorises) "G@lvo"
                ?  if:
               ¤     nilad followed by link(s) as a nilad:
           ®           recall value from register  'g'
             ØC        yield consonants            "BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz"
            e          exists in?                  1
         ⁶         ...then: 6th arg = 4th in = d   "0001" 
          ⁵        ...else: 5th arg = 3rd in = c   "5555"
        ;          concatenate                     "G@lvo0001"
                   implicit print

Tags:

Code Golf