Task 06:FOR, IF and while
preface
This time mainly explains the circular statements, including the use of if statements and their nested statements, for statements and while statements.
1, IF statement
people = 20
cats = 30
dogs = 15
if people < cats:
print("Too many cats! The world is doomed!")
if people > cats:
print("Not many cats! The wo ...
Added by rilana on Mon, 28 Feb 2022 04:49:41 +0200
Leetcode 1601: the maximum number of building change requests that can be reached (diffcult)
catalogue
1. Title Description
2. Problem solving analysis
3. Code implementation
1. Title Description
We have n buildings, numbered from 0 to n - 1. There are several employees in each building. As it is the season to change buildings, some employees want to live in another building. Give you an array of requests, where requests[i] = [ ...
Added by optimiss on Mon, 28 Feb 2022 02:47:04 +0200
TensorFlow2 self study notes
0. Preface
Tensorflow is an open source machine learning framework based on Python. It is developed by Google and has rich applications in graphics classification, audio processing, recommendation system and natural language processing. It is one of the most popular machine learning frameworks at present. TensorFlow2.0 was released in Octobe ...
Added by jbille on Sun, 27 Feb 2022 18:46:45 +0200
day10 string
day10 string
1. Correlation functions: len, str, eval
str (data) - converts the specified data into a string (any type of data can be converted into characters; when converting, it is directly quoted outside the printed value) eval (string) - evaluates the result of a string expression
2. String correlation method
join
character str ...
Added by dewed on Sun, 27 Feb 2022 18:19:54 +0200
It took so long for Numpy to really use the ndarray object
ndarray object of Numpy Library
1, ndarray object of numpy
One of the most important features of numpy is its
The dimensional array object ndarray is a collection of a series of data of the same type. The index of the elements in the collection starts with the subscript 0
To create an ndarray, you only need to call Numpy's array functio ...
Added by mgmoses on Sun, 27 Feb 2022 17:27:04 +0200
day 8 course summary
day 8 course summary
String related functions: len, str, eval
Str (data) converts the specified data into a string (put quotation marks directly outside the printed value of the data) eval (string) evaluates the result of a string expression
str1 = '[10, 20, 30]'
result = eval(str1)
print(result)
result.append(100)
print(res ...
Added by blueman on Sun, 27 Feb 2022 15:36:32 +0200
String function
String function
1.capitalize
character string. capitalize () - change the first letter of the string to uppercase and the other letters to lowercase
str = "this is string example from runoob....wow!!!"
str.capitalize()
center() - returns a string centered on the specified width, fillchar is the filled character, and the default is space. ...
Added by Cronje on Sun, 27 Feb 2022 14:19:24 +0200
day6 list job
1. Basic questions
Given a list of numbers, print all odd numbers in the list list1 = [1,2,3,4,5]
for x in list1:
if x %2 != 0:
print(x)
Given a list of numbers, print all the numbers in the list that can be divided by 3 but cannot be divided by 2 nums = [23, 45, 78, 90, 8, 21]
for x in nums:
if x % 3 == 0 and x % 2 != 0:
...
Added by sfw5000 on Sun, 27 Feb 2022 13:28:01 +0200
Python thread, role of with (automatically acquire and release Lock)
Python thread, role of with (automatically acquire and release Lock)
import threading
import time
num=0 #Global variables can be read and written by multiple threads to transfer data
mutex=threading.Lock() #Create a lock
class Mythread(threading.Thread):
def run(self):
global num
with mutex: #The function of with Lock ...
Added by jeanne on Sun, 27 Feb 2022 13:24:12 +0200
[python] Flash Web Application Framework
brief introduction
Flask is a lightweight WSGI Web application framework. It is designed to make getting started quick and easy and can be extended to complex applications. Originally a simple wrapper around Werkzeug and Jinja, it has become one of the most popular Python Web application frameworks.
Flash source code Flash User Guide
1, ...
Added by joshi_v on Sun, 27 Feb 2022 11:54:07 +0200