Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement the python English word Test on Mini Program

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report