Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement the python English word Test on Mini Program

Shulou Source: shulou.com Published: 2022-05-31 23:00:19 09月21日 Update

This article mainly introduces the relevant knowledge of "how to implement the python English word test Mini Program". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to implement the python English word test Mini Program" can help you solve the problem.

The code is as follows:

Import requests# scallop web crawler Get the English word category_res=requests.get ('https://www.shanbay.com/api/v1/vocabtest/category/?_=1566889802182')category_json=category_res.json()category_data=category_json['data']# selection question range for i in range (10): print (str (item1) +'. + category_ data [I] [1]) number=int (input ('Please choose question scope:') url=' https://www.shanbay.com/api / v1vocabtestUniverse vocabularieship headers = {'Referer':' https://www.shanbay.com/vocabtest/', 'User-Agent':' Mozilla/5.0 (Macintosh Intel Mac OS X 101404) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15'} params= {'category':category_ data [number-1] [0],' _': '1566889452889'} res=requests.get (url,headers=headers,params=params) jsonres=res.json () vacabularies=jsonres ['data'] knows= [] unknows= [] print () print (' do you know the following words?') N=0z=0b=open ('wrong word book .txt', 'wrong word') b.write ('words you don't know are:\ n') # the test begins, pick the words for vacabulary in vacabularies: n=n+1 vacabu=vacabulary [' content'] print ('th'+ str (n) +':'+ vacabu) index=vacabularies.index (vacabulary) while True: judge=input ('know Y') Do not recognize if judge=='Y': knows.append (index) break elif judge=='N': unknows.append (index) z=z+1 b.write (str (z) +'.'+ vacabu+'\ n') break else: print ('Please enter Y or N') print () print (' test is over Here are the test results:') print ('know' + str (len (knows)) + 'word, not' + str (len (unknows)) + 'word.') Print ('you're great!') Print () right= [] wrong= [] # choose the correct meaning b.write ('you have misremembered words:\ n') m=0for know in knows: vacabulary_know= vacabularies [' content'] word=vacabulary_know ['content'] print () print (word) definitions=vacabulary_know [' definition_choices'] for i in range (4): print (str (item1) +'. + definitions [I] ['definition']) choice=int (input (' word test) Please choose the correct meaning:') rank= alternatives [choice-1] ['rank'] if rank==vacabulary_know [' rank']: right.append (word) else: wrong.append (word) m=m+1 b.write (str (m) +'. + word+'\ n') print () print ('test results are back!') Print ('know the words to master these words:') print (right) print () print ('not mastered these words:') print (wrong) on "how to implement the python English word test Mini Program" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Words tests English choices programs knowledge results scope industry word meaning differences utility code content practicality practical scallops articles methods more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Tech Info macOS MySQL Xiaomi