Compare commits

...

17 Commits

31 changed files with 376 additions and 30 deletions

View File

@ -2,5 +2,11 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP1.py # @file NP1.py
def solution():
s = "Hello World!" s = "Hello World!"
print(s) print(s)
if __name__ == "__main__":
solution()

View File

@ -2,6 +2,12 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP10.py # @file NP10.py
def solution():
n1 = input() n1 = input()
n2 = input() n2 = input()
print(n1 + n2) print(n1 + n2)
if __name__ == "__main__":
solution()

View File

@ -2,5 +2,11 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP11.py # @file NP11.py
def solution():
s = input() s = input()
print(len(s)) print(len(s))
if __name__ == "__main__":
solution()

View File

@ -2,7 +2,13 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP12.py # @file NP12.py
def solution():
s = input() s = input()
print(s.lower()) print(s.lower())
print(s.upper()) print(s.upper())
print(s.title()) print(s.title())
if __name__ == "__main__":
solution()

View File

@ -2,5 +2,11 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP13.py # @file NP13.py
def solution():
s = input() s = input()
print(s.strip()) print(s.strip())
if __name__ == "__main__":
solution()

View File

@ -2,5 +2,11 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP14.py # @file NP14.py
def solution():
s = input() s = input()
print(s * 100) print(s * 100)
if __name__ == "__main__":
solution()

View File

@ -2,5 +2,11 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP15.py # @file NP15.py
def solution():
s = input() s = input()
print(s[0:10]) print(s[0:10])
if __name__ == "__main__":
solution()

21
NP/NP16.py Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP16.py
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
)
)
nameList.remove("Tom")
nameList.append("Andy")
for i in nameList:
print("{}, welcome to join us!".format(i))
if __name__ == "__main__":
solution()

13
NP/NP17.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP17.py
def solution():
s = input()
namelist = s.split(' ')
print(namelist)
if __name__ == "__main__":
solution()

11
NP/NP18.py Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP18.py
def solution():
print(list(map(int, input().split())))
if __name__ == "__main__":
solution()

11
NP/NP19.py Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP19.py
def solution():
print(len(input().split()))
if __name__ == "__main__":
solution()

View File

@ -3,7 +3,14 @@
# @date 2022/10/25 # @date 2022/10/25
# @file NP2.py # @file NP2.py
def solution():
s1 = "Hello World!" s1 = "Hello World!"
s2 = "Hello Nowcoder!" s2 = "Hello Nowcoder!"
print(s1) print(s1)
print(s2) print(s2)
if __name__ == "__main__":
solution()

13
NP/NP20.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP20.py
def solution():
nameList = input().split()
nameList.append("Allen")
print(nameList)
if __name__ == "__main__":
solution()

13
NP/NP21.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP21.py
def solution():
nameList = input().split()
nameList.insert(0, "Allen")
print(nameList)
if __name__ == "__main__":
solution()

13
NP/NP22.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP22.py
def solution():
com = input().split()
com.remove(com[0])
print(com)
if __name__ == "__main__":
solution()

13
NP/NP23.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP23.py
def solution():
name = input().split()
name.remove(input())
print(name)
if __name__ == "__main__":
solution()

13
NP/NP24.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP24.py
def solution():
names = input().split()
del names[-3:]
print(names)
if __name__ == "__main__":
solution()

15
NP/NP25.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP25.py
def solution():
my_list = ["P", "y", "t", "h", "o", "n"]
print(sorted(my_list))
print(my_list)
my_list.sort(reverse=True)
print(my_list)
if __name__ == "__main__":
solution()

14
NP/NP26.py Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP26.py
def solution():
num = [3, 5, 9, 0, 1, 9, 0, 3]
# print(num)
num.reverse()
print(num)
if __name__ == "__main__":
solution()

18
NP/NP27.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP27.py
def solution():
name = ["Niumei", "YOLO", "Niu Ke Le", "Mona"]
friends = []
friends.append(name)
food = ["pizza", "fish", "potato", "beef"]
friends.append(food)
number = [3, 6, 0, 3]
friends.append(number)
print(friends)
if __name__ == "__main__":
solution()

21
NP/NP28.py Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP28.py
def solution():
# num1 = input()
# num2 = []
# for i in range(len(num1)):
# num2.append((int(num1[i]) + 3) % 9)
# num2[0], num2[2] = num2[2], num2[0]
# num2[1], num2[3] = num2[3], num2[1]
# for i in num2:
# print(i, end="")
s = input()
print("".join(str((int(num) + 3) % 9) for num in (s[2], s[3], s[0], s[1])))
if __name__ == "__main__":
solution()

18
NP/NP29.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP29.py
def solution():
num = int(input())
stack = [1, 2, 3, 4, 5]
stack.pop()
print(stack)
stack.pop()
print(stack)
stack.append(num)
print(stack)
if __name__ == "__main__":
solution()

View File

@ -2,5 +2,15 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP3.py # @file NP3.py
def solution():
s1 = "Hello World!"
s2 = "Hello Nowcoder!"
print(s1)
print(s2)
if __name__ == "__main__":
solution()
s = input() s = input()
print(s) print(s)

18
NP/NP30.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP30.py
def solution():
num = int(input())
queue = [1, 2, 3, 4, 5]
queue.pop(0)
print(queue)
queue.pop(0)
print(queue)
queue.append(num)
print(queue)
if __name__ == "__main__":
solution()

14
NP/NP31.py Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/26
# @file NP31.py
def solution():
group_list = ["Tom", "Allen", "Jane", "William", "Tony"]
print(group_list[0:2])
print(group_list[1:4])
print(group_list[3:5])
if __name__ == "__main__":
solution()

View File

@ -2,6 +2,16 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP4.py # @file NP4.py
def solution():
s1 = "Hello World!"
s2 = "Hello Nowcoder!"
print(s1)
print(s2)
if __name__ == "__main__":
solution()
num = int(input()) num = int(input())
print(num) print(num)
print(type(num)) print(type(num))

View File

@ -2,5 +2,15 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP5.py # @file NP5.py
def solution():
s1 = "Hello World!"
s2 = "Hello Nowcoder!"
print(s1)
print(s2)
if __name__ == "__main__":
solution()
name = input() name = input()
print("I am %s and I am studying Python in Nowcoder!" % name) print("I am %s and I am studying Python in Nowcoder!" % name)

View File

@ -2,5 +2,15 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP6.py # @file NP6.py
def solution():
s1 = "Hello World!"
s2 = "Hello Nowcoder!"
print(s1)
print(s2)
if __name__ == "__main__":
solution()
num = float(input()) num = float(input())
print("%0.2f" % num) print("%0.2f" % num)

View File

@ -2,5 +2,11 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP7.py # @file NP7.py
def solution():
num = float(input()) num = float(input())
print(int(num)) print(int(num))
if __name__ == "__main__":
solution()

View File

@ -2,7 +2,13 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP8.py # @file NP8.py
def solution():
a = int(input()) a = int(input())
num = float(a) num = float(a)
print(num) print(num)
print(type(num)) print(type(num))
if __name__ == "__main__":
solution()

View File

@ -2,6 +2,12 @@
# @author 轩辕龙儿 # @author 轩辕龙儿
# @date 2022/10/25 # @date 2022/10/25
# @file NP9.py # @file NP9.py
def solution():
num16 = input() num16 = input()
num10 = int(num16, 16) num10 = int(num16, 16)
print(num10) print(num10)
if __name__ == "__main__":
solution()