#### Python exercise 8 - Rock Paper Scissors

Exercise 8 - Rock Paper Scissors ''' Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game) Remembe

#### Python exercise 9 - Guessing Game

Exercise 9 - Guessing Game ''' Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. (Hint: remember to use the user input lessons fro

#### PYTHON Exercise 1 Input & Print

Exercise 1 - Input & Print ''' Exercise: Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old. ''' Code: # code: name = input ('Pleas

#### Python exercise 2 - Odd or Even

Python exercise 2 - Odd or Even ''' Exercise 2 - Odd or Even Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] and write a program that prints out all the elements of the list that are less than 5. Extras: Ins

#### Python exercise 10 - List Overlap Comprehensions

Python exercise 10 - List Overlap Comprehensions ''' This week’s exercise is going to be revisiting an old exercise (see Exercise 5), except require the solution in a different way. Take two lists, say for example these two: a = [1, 1, 2, 3, 5, 8,

#### Python exercise 11 - Check Primality Functions

Python exercise 11 - Check Primality Functions ''' Ask the user for a number and determine whether the number is prime or not. (For those who have forgotten, a prime number is a number that has no divisors.). You can (and should!) use your answer to

#### Python exercise 12 - List Ends

Python exercise 12 - List Ends ''' Write a program that takes a list of numbers (for example, a = [5, 10, 15, 20, 25]) and makes a new list of only the first and last elements of the given list. For practice, write this code inside a function. **Con

#### Python exercise 3 -list & lambda

Python exercise 3 -list & lambda Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] and write a program that prints out all the elements of the list that are less than 5. Extras: Instead of print

#### Python exercise 4 - divisors

Python exercise 4 - divisors Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don’t know what a divisor is, it is a number that divides evenly into another number. For ex

#### Python exercise 5 - List Overlap

Python exercise 5 - List Overlap Take two lists, say for example these two: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] and write a program that returns a list that contains only the elements that a

#### Python exercise 6 - string & list

Python exercise 6 - string & list Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.) Code 1: a=str(input('Please enter a str: ')) l=len(a) x=0 f

#### 装饰器中的@functools.wraps的作用

def login_required(view_func): @functools.wraps(view_func) def wrapper(*args, **kwargs): ...... return view_func(*args,**kwargs) return wrapper 在wrapper上面使用这个装饰器可以让view_func.__name__或者view_func.__doc__访问的还是原先那个

#### Web项目容器集成ActiveMQ & SpringBoot整合ActiveMQ

集成tomcat就是随项目启动而启动tomcat，最简单的方法就是监听器监听容器创建之后以Broker的方式启动ActiveMQ。 1.web项目中Broker启动的方式进行集成 　　在这里采用Listener监听ServletContext创建和销毁进行Broker的启动和销毁。 0.需要的jar包: 1.listener实现ServletContextListener接口 package cn.qlq.listener; import javax.servlet.ServletC

#### powershell复制文件夹的文件

#分别定义源、目标文件夹，注意大小写敏感 \$folder_a_path = "D:\Leishen\Source_Publish\api" \$folder_b_path = "D:\Leishen\Test_Publish\api" #遍历源文件夹下所有文件 \$folders_a = gci \$folder_a_path -Recurse foreach (\$folder_a in \$folders_a) { #通过替换的方式，取目标文件的全路径名称 \$b = \$f