Download:Android application building practice + principle in detail
Based on the latest construction tool chain, this course takes the development and release of a page routing framework as the main line, combines actual practice with theory, and deeply learns Gradle’s popular compile-time annotation processing, bytecode peg and other advanced technologies, leading everyone to systematically master the knowledge of Android application construction and improve the development efficiency. Technical language: Groovy/Java/Kotlin Android: Android Studio 4.0+Gradle: 6.0+ Android Gradle Plugin: 4.1.0+ import random 2 if name
Checkcode =”” # checkcode variable 4 for I in range(4): 5 index=random. Randrange (0,4) =i and index +1 ! = I: 7 checkCode += CHR (random.randint(97,122)) # generate a z in a lowercase letter 8 elif index +1
I: 9 checkcode += CHR (random.randint(65,90)) # generate A uppercase letter in A~Z 10 else: 11 print(checkCode) (m47A, 8wQ9, vugS
2. Formatting time function
3 import time4 return time.strftime(“%Y-%m-%d “) 3 def formatTime(longtime): 300 %H:%M:%S”,time.localtime(longtime))
3. Record the display log instance
Import time def show_info(): print() def write_loginfo(username): Run the following command to log the username and login time :param username: username with open(‘ log.txt ‘, ‘a’) as f: String = “User name: {} Login time: {} \ n “. The format (username, time strftime (‘ % % Y – m – H: % d % % m: % S ‘, and time. The localtime (time. Time ()))) f.w rite def (string) Read_loginfo (): “” “with open(‘ log.txt ‘, ‘r’) as f: while True: line = f.readline() if line == “” : Print (line) if name == “main” : While len(username) < 2: Print (‘ username ‘=’ input ‘) print(‘ username ‘=’ input ‘) print(‘ username ‘=’ input ‘) print(‘ username ‘=’ input ‘) print(‘ username ‘=’ input ‘) Print (‘ Password should be at least 6 characters long ‘) password = input(‘ Please enter password: Num = int(input(‘ enter ‘)) # print(‘ enter ‘) # print(‘ enter ‘) # print(‘ enter ‘) # If num == 0: print(‘ exit ‘) break elif num == 1: Print (‘ print ‘) read_loginfo() show_info() num = int(input(‘ print ‘) else: Print (‘ print ‘) show_info() num = int(input(‘ print ‘)
3. 3 def find_answer(question): 4 with open(‘ reply. TXT ‘, ‘r’) as f: 5 while True: 6 line=f.readline() 7 if not line: # can also for the if the line = = ‘9’ 8 break keyword = line. The split (‘ | ‘) [0] 10. Reply = line split (‘ | ‘) [1] 11 if keyword in question: Sorry, there is no question you are looking for
‘main’ : 16 question=input(‘ Please input what you want to ask: ‘) 17 while True: 18 if question
‘bye’ : 19 break 20 reply=find_answer(question) 21 if not reply: 22 question=input(” I don’t know what you are talking about, you can ask something about order, account and payment (to exit please enter bye) : “) 24 print(reply) 25 question=input(” You can ask something about order, account and payment (please enter bye to exit) : “) ‘) 27 Copy code Copy code 4. Find the maximum number of treaties and least common multiple (division by toss and turn) Maximum number of treaties: refers to two or more integers common divisors of the largest
Least common multiple: The common multiple of two or more integers is called their common multiple, where the least common multiple other than 0 is called the least common multiple of the integers
Relation: Product of two numbers = least common multiple * maximum treaty number
1 a=int(input(‘ 1: ‘)) 2 b=int(input(‘ 2: ‘)) 3 s=a*b 4 while a%b! =0: 5 a,b=b,(a%b) 6 print(a) 7 print(b) 8 else: Print (s//b, ‘is the least common multiple’
1 a=int(input(‘ please enter 1st num: ‘)) 2 b=int(input(‘ please enter 2nd num: ‘)) 3 s=a*b 4 5 while a! =b: 6 if a>b: 7 a-=b 8 elif a
0 and num%100 ! =0) or num %400
0: 9 print(num, “leap year”) 10 else: Import Calendar year = int(input(” please enter the year: “)) check_year=calendar. isLEAP (year) if check_year= = True: print (” leap year “) else: print (” leap year “) copy code 6. Import re 2 str_test= ‘abcdefgHABC123456 Chinese nation’ 34 # Compile regular expressions into objects. If the object is used frequently, this method can improve the efficiency 5 Num_regex = re.pile (r ‘[u4e00-U9fa5]’) 6 Zimu_regex = re.pile (r ‘[u4e00-U9fa5]’) 8 9 print(‘ Input string: ‘,str_test)