reciteword.py

#/bin/usr/python
# -*- coding=utf-8 -*-
import random

#定义英文列表和中文列表
englishList=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday','January','February','March','April','May','June','July','August','September','October','November','December','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety','first','second','third','forth','fifth','sixth','seventh','eighth','ninth','tenth','eleventh','twelfth','thirteenth','fourteenth','fifteenth','sixteenth','seventeenth','eighteenth','nineteenth','twentieth','twenty-first','precious','reckless','refute','sanction','slight','agitate','correlate','desirable','strenuous','spray','affirm','reckon','saint','satire','stern','tempt','arrogant','fabricate','formidable','fragrant','indispensable','intricate','odds','odd','solitary','specify','speculate','stall','authentic','inertia','malignant','marvelous','miserable','preclude','splendid','sack','carpet','freight','retrospect','revise','revive','revolt','pneumonia','brisk','abdomen','abide','zeal','thorny','breach','underlying','nominal','nominate','notable','transient','transistor','transition','translate','wretched','wrinkle','fabulous','superstition','allege','frown','fruitful','overflow','overhead','overpass','overtake','overthrow','overturn','ridge','opaque','rather','cue','dash','grant','enlight','entitle','ritual','roast','endow','endure','departure','uproar','redundant','perplex','verdict','resent','venture','ventilate','converge','empirical','permeat','exempt','scarce','scarcely','scatter','scent','acclaim','accommodate','accordance','account','accountant','escalate','esteem','ethnic','evacuate','evade','faint','fair','fairly','fairy','pearl','peasant','pebble','peculiar','embody','']

chineseList=['星期一','星期二','星期三','星期四','星期五','星期六','星期天','一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','30','40','50','60','70','80','90','第一','第二','第三','第四','第五','第六','第七','第八','第九','第十','第十一','第十二','第十三','第十四','第十五','第十六','第十七','第十八','第十九','第二十','第二十一','珍贵的','鲁莽的','反驳','批准、制裁','轻微的、瘦弱、冷落','摇动、煽动','互相关联','称心的','费力的、努力的','喷雾、喷射','断言、证实','估计、指望','圣人、基督教徒','讽刺','严厉的、船尾','诱惑','傲慢的','捏造、制造','令人敬畏的、可怕的、艰难的','香的','必不可少的','复杂的、难以理解的','不平等、机会、差异','奇数的、奇怪的、单只的','a:孤独的、偏僻的、唯一的','vt:指定、详细说明','vt:思索、推测、投机','n:货摊、马厩、停止','a:真正的、可信的','n:不活动、惰性、惯性','a:恶性的、恶意的、恶毒的','a:惊人的、妙极了的','a:痛苦的、悲惨的','vt:排除、阻止、妨碍','a:壮丽的、极好的、辉煌的','n:麻袋、解雇','n:地毯','vt:运送、n:船运','v/n:回顾、追溯','vt:修订、修正','vt:恢复、复苏','n:反抗、vi:造反、vt:使厌恶','n:肺炎','a:轻快的、生机勃勃的、兴隆的','n:腹部(胸到腿部的部分)','vi:遵守、vt:忍受','n:热心、热情','a:令人苦恼的、棘手的、麻烦的','n:违反、vt:攻破','a:含蓄的、潜在的、在下面的','a:名义上的、(金额、租金)微不足道的','vt:提名、任命','a:值得注意的、显著的、著名的','a:短暂的、临时的','n:晶体管、晶体管收音机','n:转变、过渡','vi/vt:翻译、解释、转化','a:可怜的、肮脏的、恶劣的','n:皱纹、vt:起皱纹','a:极好的、寓言中的','n:迷信、迷信的观念和习俗','vt:断言、宣称、指控','vi:皱眉、不同意、vt:用皱眉表示','a:多产的、果实累累的、富有成效的','vi/vt:外溢、溢出、挤满了人','a:在头顶上的、n:企业一般管理费用、生产和贸易费用','n:立交桥','vt:追上、超过、袭击、压倒','vt:推翻、颠覆','n:倾覆','n:山脉、屋脊、鼻梁','a:不透明的、难理解的、晦涩的','ad:相当、有一点儿、宁愿、宁可','vt/n:暗示、提示','v/n:冲、猛冲、突进、破折号','vt:同意、承认、n:授予物、津贴','vt:启发、启蒙、教导','vt:给以权力(或资格)、给以称号(提名)、授权','宗教仪式的、仪式','烤、变热、发烫','资助、给予','持久、持续、忍耐','离开、启程、违背','骚动、喧嚣','多余的、(食物)丰富的、被解雇的','使困惑、使复杂化','判决、判断','对什么表示愤恨、怨恨','冒险','使通风','汇合、使聚集','经验主义的','弥漫、渗透','免除、免税者','缺乏的、罕见的','仅仅、勉强','散开','气味、香味、嗅觉','公认、欢呼、称赞','向什么提供住宿、容纳、适应','一致、和谐、符合','叙述、账户、说明','会计人员','逐步增长、逐步升级','尊敬、尊重','种族的、人种学的','撤离、疏散','逃避','微弱的、暗淡的、昏倒','公平的、合理的、集市','公正的、相当','幻想中的、仙女','珍珠','农民','卵石','古怪的、特殊的','具体表达、包含、收录','']

#这里的乱序只是从不同的地方开始而已
listLength=len(englishList)
index=random.randint(0,listLength-1)
word='word'
#为了实现单词随机,需要再引入一个计数变量用于把list中的单词便利完
count=0  #为了将列表中所有单词遍历完
correctNum=0.0
falseNum=0.0
correctRate=0.0

print '*******************************************😊 我的记单词软件😊 ***************************************************'
print '请输入下列口令的序号:\n1、乱序记忆\n2、顺序记忆\n3、打印所有单词\n4、倒叙记忆\n5、查找\n'
learnMode=str(raw_input('学习模式:'))
if learnMode == '1':
	while count<listLength:
		print englishList[index]
		word=str(raw_input('请输入该单词意思:'))
		if word == chineseList[index]:
			correctNum=correctNum+1
			print '******************* ✅  **********************\n'
		else:
			falseNum=falseNum+1
			print '******************* ❌  **********************'
			print '正确意思:',chineseList[index],'\n'
		if index == listLength-1:
			index=-1
		index=index+1
		count=count+1	
elif learnMode == '2':
	while count<listLength:
 		print englishList[count]
 		word=str(raw_input('请输入该单词意思:'))
 		if word == chineseList[count]:
			correctNum=correctNum+1
 			print '******************* ✅  **********************\n'
		else:
			falseNum=falseNum+1
 			print '******************* ❌  **********************\n'
 			print '正确意思:',chineseList[index],'\n'
		count = count+1
elif learnMode == '3':
	while count<listLength:
		print englishList[count],' : ',chineseList[count]
		print '------------------------------------------------------'
		count=count+1
		
elif learnMode == '4':
	listLength=listLength-1
	while listLength>=0:
		print englishList[listLength]
		word=str(raw_input('请输入该单词意思:'))
		if word == chineseList[listLength]:
			correctNum=correctNum+1
			print '******************* ✅  **********************\n'
		else:
			falseNum=falseNum+1
			print '******************* ❌  **********************\n'
			print '正确意思:',chineseList[listLength],'\n'
		listLength=listLength-1
elif learnMode == '5':
	searchWord=str(raw_input('需要查找的单词:'))
	while count<listLength:
		if englishList[count]==searchWord:
			print '该单词意思:',chineseList[count]
			break
		count=count+1
	if count==listLength:
		print '你所查找的单词不存在!'
print '你的正确率为:',correctNum/len(chineseList)

print '本次记忆单词结束!欢迎下次回来,👏 👏 👏 👏 👏 👏 👏!👏 👏 👏 👏!👏 👏 👏 👏 👏 !'

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
你能在这段代码里面添加删除存储的数据功能package com.example.reciteword; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import androidx.fragment.app.Fragment; import java.util.ArrayList; import java.util.List; import java.util.Random; public class wrongFragment extends Fragment { private List<Word> wordList = new ArrayList<>(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_wrong, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final SharedPreferences sharedPre = getActivity().getSharedPreferences("t",Context.MODE_PRIVATE); final int[] wrongNum = {sharedPre.getInt("wrongNum", 0)}; System.out.println(wrongNum[0]); wordList.clear(); for(int i = 1;i<=wrongNum[0];i++){ int temp = sharedPre.getInt("wrong"+i, 0); Word word = new Word(Data.getWord(temp),Data.getPron(temp),Data.getwordDefine(temp),sharedPre.getInt("word"+temp,1),0); System.out.println(Data.getRandNum()+":"+sharedPre.getInt("word"+temp,9)); wordList.add(word); } WordAdapter adapter = new WordAdapter(getActivity(),R.layout.word_item,wordList); ListView listView = (ListView) getActivity().findViewById(R.id.wrong_list_view); listView.setAdapter(adapter); } }
最新发布
05-11
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值