The PERFECT Script For TROLLING In Python #code #programming #python

学習

This is the perfect script for trolling in Python. #code #programming #python

コメント

  1. Max Caimits より:

    return ”.join((c.lower if i % 2 else c.upper)() for i, c in enumerate(s))

    Why loop if it’s exactly when comprehensions are used?

  2. Nathan Chambers より:

    Making it a 1 liner is actually more readable than the split up code lol

    return ”.join([c.upper() if i % 2 == 0 else c.lower() for i, c in enumerate(s)])

  3. Aliou DIOUF より:

    Instead of using a list, you can use another string initialized by ”.
    def alt_caps(in_str):
    out_str = ”
    for i, c in enumerate(in_str):
    if i % 2:
    out_str += c.lower()
    else:
    out_str += c.upper()
    return out_str

タイトルとURLをコピーしました