Ad
Sets
Code
Diff
  • def dumbRockPaperScissors(p1,p2,rpc={"Rock":"Paper","Paper":"Scissors","Scissors":"Rock"}):
        if p1 in rpc[p2]: return "Player 1 wins"
        if p2 in rpc[p1]: return "Player 2 wins"
        return "Draw"
     
    
    • def dumbRockPaperScissors(player1, player2):
    • Rock = {"Paper"}
    • Paper = {"Scissors"}
    • Scissors = {"Rock"}
    • if player1 in eval(player2):
    • return "Player 1 wins"
    • if player2 in eval(player1):
    • return "Player 2 wins"
    • def dumbRockPaperScissors(p1,p2,rpc={"Rock":"Paper","Paper":"Scissors","Scissors":"Rock"}):
    • if p1 in rpc[p2]: return "Player 1 wins"
    • if p2 in rpc[p1]: return "Player 2 wins"
    • return "Draw"

Made it a lambda and changed """ with "

Code
Diff
  • text=lambda d="description",k="Kata or Kumite",r="return",s="symbols": f"Compress large text - {d} of this {k} in small code.\nThis {k} {d} has 462 {s} in 3 line, without title. You should wrote function, {r} this text, but you should use less {s} in you'r code that this text. Simple solution - just {r} \"\"\"source text\"\"\". More smart variant is: do mark often word as special {s} and replace his before {r}.\nHow small code can be? Can you wrote more compressing? Let's check it!"
    • def text():
    • d,k,r,s="description","Kata or Kumite","return","symbols"
    • return f"""Compress large text - {d} of this {k} in small code.
    • This {k} {d} has 462 {s} in 3 line, without title. You should wrote function, {r} this text, but you should use less {s} in you'r code that this text. Simple solution - just {r} \"\"\"source text\"\"\". More smart variant is: do mark often word as special {s} and replace his before {r}.
    • How small code can be? Can you wrote more compressing? Let's check it!"""
    • text=lambda d="description",k="Kata or Kumite",r="return",s="symbols": f"Compress large text - {d} of this {k} in small code.\nThis {k} {d} has 462 {s} in 3 line, without title. You should wrote function, {r} this text, but you should use less {s} in you'r code that this text. Simple solution - just {r} \"\"\"source text\"\"\". More smart variant is: do mark often word as special {s} and replace his before {r}.\nHow small code can be? Can you wrote more compressing? Let's check it!"
Code
Diff
  • hello_world=lambda world: "No "*(not world) + "Hello "*world + "World" + " baby"*world
    • hello_world=lambda world: "No "*(1-world) + "Hello "*world + "World" + " baby"*world
    • hello_world=lambda world: "No "*(not world) + "Hello "*world + "World" + " baby"*world
Sets

Code stops running at return statement so elif and and aren't needed

Code
Diff
  • def dumbRockPaperScissors(player1, player2):
        Rock = {"Paper"}
        Paper = {"Scissors"}
        Scissors = {"Rock"}
        if player1 in eval(player2):
            return "Player 1 wins"
        if player2 in eval(player1):
            return "Player 2 wins"
        return "Draw"
     
    
    • def dumbRockPaperScissors(player1, player2):
    • Rock = {"Paper"}
    • Paper = {"Scissors"}
    • Scissors = {"Rock"}
    • if player1 in eval(player2):
    • return "Player 1 wins"
    • elif player2 in eval(player1):
    • if player2 in eval(player1):
    • return "Player 2 wins"
    • else:
    • return "Draw"
    • return "Draw"
Code
Diff
  • hello_world=lambda world: "No "*(1-world) + "Hello "*world + "World" + " baby"*world
    • def hello_world(world): return "Hello World baby" if world else 'No World'
    • hello_world=lambda world: "No "*(1-world) + "Hello "*world + "World" + " baby"*world
Code
Diff
  • Greeting=lambda name,rank="",formal=0: f"He{('y','llo')[formal]}, {rank*formal}{' '*bool(rank and formal)}{name}{'!.'[formal]}"
    • greeting=Greeting=lambda name,rank='',formal=False:"He{0}, {1}{2}{3}{4}".format(('y','llo')[formal],rank*formal,' '*bool(rank and formal),name,'!.'[formal])
    • Greeting=lambda name,rank="",formal=0: f"He{('y','llo')[formal]}, {rank*formal}{' '*bool(rank and formal)}{name}{'!.'[formal]}"