From 3123313dc4208f1f8a3ea3fcf72f043e58f38f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BD=A9=E8=BE=95=E9=BE=99=E5=84=BF?= Date: Wed, 26 Oct 2022 10:02:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0main=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NP/NP1.py | 10 ++++++++-- NP/NP10.py | 12 +++++++++--- NP/NP11.py | 10 ++++++++-- NP/NP12.py | 14 ++++++++++---- NP/NP13.py | 10 ++++++++-- NP/NP14.py | 10 ++++++++-- NP/NP15.py | 10 ++++++++-- NP/NP16.py | 26 ++++++++++++++++---------- NP/NP2.py | 15 +++++++++++---- NP/NP3.py | 10 ++++++++++ NP/NP4.py | 10 ++++++++++ NP/NP5.py | 10 ++++++++++ NP/NP6.py | 10 ++++++++++ NP/NP7.py | 10 ++++++++-- NP/NP8.py | 14 ++++++++++---- NP/NP9.py | 12 +++++++++--- 16 files changed, 153 insertions(+), 40 deletions(-) diff --git a/NP/NP1.py b/NP/NP1.py index 9302348..6ed7fbd 100644 --- a/NP/NP1.py +++ b/NP/NP1.py @@ -2,5 +2,11 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP1.py -s = "Hello World!" -print(s) + +def solution(): + s = "Hello World!" + print(s) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP10.py b/NP/NP10.py index a70868b..2c60b4d 100644 --- a/NP/NP10.py +++ b/NP/NP10.py @@ -2,6 +2,12 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP10.py -n1 = input() -n2 = input() -print(n1 + n2) + +def solution(): + n1 = input() + n2 = input() + print(n1 + n2) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP11.py b/NP/NP11.py index d95fbfd..c5e7db0 100644 --- a/NP/NP11.py +++ b/NP/NP11.py @@ -2,5 +2,11 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP11.py -s = input() -print(len(s)) + +def solution(): + s = input() + print(len(s)) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP12.py b/NP/NP12.py index 5862069..0a5259e 100644 --- a/NP/NP12.py +++ b/NP/NP12.py @@ -2,7 +2,13 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP12.py -s = input() -print(s.lower()) -print(s.upper()) -print(s.title()) + +def solution(): + s = input() + print(s.lower()) + print(s.upper()) + print(s.title()) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP13.py b/NP/NP13.py index add800e..f10fd37 100644 --- a/NP/NP13.py +++ b/NP/NP13.py @@ -2,5 +2,11 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP13.py -s = input() -print(s.strip()) + +def solution(): + s = input() + print(s.strip()) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP14.py b/NP/NP14.py index 4dcc144..af9c438 100644 --- a/NP/NP14.py +++ b/NP/NP14.py @@ -2,5 +2,11 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP14.py -s = input() -print(s * 100) + +def solution(): + s = input() + print(s * 100) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP15.py b/NP/NP15.py index 78191d9..a4bf846 100644 --- a/NP/NP15.py +++ b/NP/NP15.py @@ -2,5 +2,11 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP15.py -s = input() -print(s[0:10]) + +def solution(): + s = input() + print(s[0:10]) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP16.py b/NP/NP16.py index 243c9e1..23b9225 100644 --- a/NP/NP16.py +++ b/NP/NP16.py @@ -2,14 +2,20 @@ # @author 轩辕龙儿 # @date 2022/10/26 # @file NP16.py -list = ["Allen", "Tom"] -for i in list: - print( - "{}, you have passed our interview and will soon become a member of our company.".format( - i + +def solution(): + nameList = ["Allen", "Tom"] + for i in nameList: + print( + "{}, you have passed our interview and will soon become a member of our company.".format( + i + ) ) - ) -list.remove("Tom") -list.append("Andy") -for i in list: - print("{}, welcome to join us!".format(i)) + nameList.remove("Tom") + nameList.append("Andy") + for i in nameList: + print("{}, welcome to join us!".format(i)) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP2.py b/NP/NP2.py index eeed634..46a8824 100644 --- a/NP/NP2.py +++ b/NP/NP2.py @@ -3,7 +3,14 @@ # @date 2022/10/25 # @file NP2.py -s1 = "Hello World!" -s2 = "Hello Nowcoder!" -print(s1) -print(s2) +def solution(): + s1 = "Hello World!" + s2 = "Hello Nowcoder!" + print(s1) + print(s2) + + +if __name__ == "__main__": + solution() + + diff --git a/NP/NP3.py b/NP/NP3.py index b52ff3e..843709e 100644 --- a/NP/NP3.py +++ b/NP/NP3.py @@ -2,5 +2,15 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP3.py + +def solution(): + s1 = "Hello World!" + s2 = "Hello Nowcoder!" + print(s1) + print(s2) + + +if __name__ == "__main__": + solution() s = input() print(s) diff --git a/NP/NP4.py b/NP/NP4.py index 600421f..f12443e 100644 --- a/NP/NP4.py +++ b/NP/NP4.py @@ -2,6 +2,16 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP4.py + +def solution(): + s1 = "Hello World!" + s2 = "Hello Nowcoder!" + print(s1) + print(s2) + + +if __name__ == "__main__": + solution() num = int(input()) print(num) print(type(num)) diff --git a/NP/NP5.py b/NP/NP5.py index c736654..eb86d73 100644 --- a/NP/NP5.py +++ b/NP/NP5.py @@ -2,5 +2,15 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP5.py + +def solution(): + s1 = "Hello World!" + s2 = "Hello Nowcoder!" + print(s1) + print(s2) + + +if __name__ == "__main__": + solution() name = input() print("I am %s and I am studying Python in Nowcoder!" % name) diff --git a/NP/NP6.py b/NP/NP6.py index 181af87..fb52b54 100644 --- a/NP/NP6.py +++ b/NP/NP6.py @@ -2,5 +2,15 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP6.py + +def solution(): + s1 = "Hello World!" + s2 = "Hello Nowcoder!" + print(s1) + print(s2) + + +if __name__ == "__main__": + solution() num = float(input()) print("%0.2f" % num) diff --git a/NP/NP7.py b/NP/NP7.py index 73c5b35..d3c4f2e 100644 --- a/NP/NP7.py +++ b/NP/NP7.py @@ -2,5 +2,11 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP7.py -num = float(input()) -print(int(num)) + +def solution(): + num = float(input()) + print(int(num)) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP8.py b/NP/NP8.py index 041c9cb..8a35276 100644 --- a/NP/NP8.py +++ b/NP/NP8.py @@ -2,7 +2,13 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP8.py -a = int(input()) -num = float(a) -print(num) -print(type(num)) + +def solution(): + a = int(input()) + num = float(a) + print(num) + print(type(num)) + + +if __name__ == "__main__": + solution() diff --git a/NP/NP9.py b/NP/NP9.py index 5f1aa6a..b4a66b1 100644 --- a/NP/NP9.py +++ b/NP/NP9.py @@ -2,6 +2,12 @@ # @author 轩辕龙儿 # @date 2022/10/25 # @file NP9.py -num16 = input() -num10 = int(num16, 16) -print(num10) + +def solution(): + num16 = input() + num10 = int(num16, 16) + print(num10) + + +if __name__ == "__main__": + solution()