添加main方法,方便测试
This commit is contained in:
parent
a7e783e361
commit
3123313dc4
@ -2,5 +2,11 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP1.py
|
||||
|
||||
def solution():
|
||||
s = "Hello World!"
|
||||
print(s)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,6 +2,12 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP10.py
|
||||
|
||||
def solution():
|
||||
n1 = input()
|
||||
n2 = input()
|
||||
print(n1 + n2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,5 +2,11 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP11.py
|
||||
|
||||
def solution():
|
||||
s = input()
|
||||
print(len(s))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,7 +2,13 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP12.py
|
||||
|
||||
def solution():
|
||||
s = input()
|
||||
print(s.lower())
|
||||
print(s.upper())
|
||||
print(s.title())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,5 +2,11 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP13.py
|
||||
|
||||
def solution():
|
||||
s = input()
|
||||
print(s.strip())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,5 +2,11 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP14.py
|
||||
|
||||
def solution():
|
||||
s = input()
|
||||
print(s * 100)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,5 +2,11 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP15.py
|
||||
|
||||
def solution():
|
||||
s = input()
|
||||
print(s[0:10])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
16
NP/NP16.py
16
NP/NP16.py
@ -2,14 +2,20 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/26
|
||||
# @file NP16.py
|
||||
list = ["Allen", "Tom"]
|
||||
for i in list:
|
||||
|
||||
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:
|
||||
nameList.remove("Tom")
|
||||
nameList.append("Andy")
|
||||
for i in nameList:
|
||||
print("{}, welcome to join us!".format(i))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -3,7 +3,14 @@
|
||||
# @date 2022/10/25
|
||||
# @file NP2.py
|
||||
|
||||
def solution():
|
||||
s1 = "Hello World!"
|
||||
s2 = "Hello Nowcoder!"
|
||||
print(s1)
|
||||
print(s2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
||||
|
||||
|
10
NP/NP3.py
10
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)
|
||||
|
10
NP/NP4.py
10
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))
|
||||
|
10
NP/NP5.py
10
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)
|
||||
|
10
NP/NP6.py
10
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)
|
||||
|
@ -2,5 +2,11 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP7.py
|
||||
|
||||
def solution():
|
||||
num = float(input())
|
||||
print(int(num))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
@ -2,7 +2,13 @@
|
||||
# @author 轩辕龙儿
|
||||
# @date 2022/10/25
|
||||
# @file NP8.py
|
||||
|
||||
def solution():
|
||||
a = int(input())
|
||||
num = float(a)
|
||||
print(num)
|
||||
print(type(num))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
solution()
|
||||
|
Loading…
Reference in New Issue
Block a user