Question: The following Python code is what I have already tried in field calculator of ArcMap 10.5.1:

Pre-Logic Script Code:

```
def ConcatAddr(!JOIN_KEY!)
      val = ""
          if !Address! <> val
              return !Address! + " "
          else
              return val
          if !StreetName! <> val
              return !StreetName! + " "
          else
              return val
          if !Apartment! <> val
              return !Apartment! + " "
          else
              return val
          if !CityCode! <> val
              return !CityCode! + " "
          else
              return val
          if !ZipCode! <> val
              return !ZipCode! + " "
          else
              return val

JOIN_KEY =
ConcatAddr(!JOIN_KEY!)

```

Answer: 
```
def ConcatAddr(Adress,Streetname,Apartment,Citycode,Zipcode):
    return ' '.join([str(i) for i in [Adress,Streetname,Apartment,Citycode,Zipcode] if i not in(None,' ')])

```

Use Python parser and call with

JOIN\_KEY=

```
ConcatAddr(!Adress!,!Streetname!,!Apartment!,!Citycode!,!Zipcode!)

```

(You can also define the function as:

```
def ConcatAddr(*args):
    return ' '.join([str(i) for i in args if i not in(None,' ')])

```

and it will take any number of inputs)
Similar (well, equivalent really) to @BERA 's answer, you could use Python's built-in [`filter` function](https://docs.python.org/2.7/library/functions.html#filter):

```python
' '.join(filter(
    lambda s: (s or '').strip(),
    [!Adress!,!Streetname!,!Apartment!,!Citycode!,!Zipcode!]
 ))

```

Filter will keep items from the list which are logically `True`. Empty strings (and `None`) values are logically `False`, so the `lambda` simply returns a stripped string value. Again, you can call this with the Python parser.