From d6ae9ddf0c4608dfdc5d35e8f5a0f5d9ccf70468 Mon Sep 17 00:00:00 2001 From: "codeflash-ai[bot]" <148906541+codeflash-ai[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 06:19:30 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Speed=20up=20function=20`g?= =?UTF-8?q?et=5Ffull=5Fname`=20by=2011%=20Here's=20a=20more=20efficient=20?= =?UTF-8?q?version=20of=20the=20`get=5Ffull=5Fname`=20function.=20By=20usi?= =?UTF-8?q?ng=20f-strings=20for=20string=20concatenation=20and=20calling?= =?UTF-8?q?=20the=20`title()`=20method=20only=20once=20per=20string,=20we?= =?UTF-8?q?=20can=20slightly=20optimize=20the=20function.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs_src/python_types/tutorial001.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs_src/python_types/tutorial001.py b/docs_src/python_types/tutorial001.py index 09039435f1420..ee0498480712c 100644 --- a/docs_src/python_types/tutorial001.py +++ b/docs_src/python_types/tutorial001.py @@ -1,6 +1,5 @@ def get_full_name(first_name, last_name): - full_name = first_name.title() + " " + last_name.title() - return full_name + return f"{first_name.title()} {last_name.title()}" print(get_full_name("john", "doe"))