Ejemplo n.º 1
0
def get_max_range():
	max_range = 1
	while max_range%10 != 0:
		try:
			max_range = 10**int(get_input())
			if max_range >= 10**12:
				max_range = 5 #just to keep it in the loop
				print "Invalid input. Choose r to be from 0-11 only!"
		except:
			print "Invalid input. Choose r to be from 0-11 only!"
	return max_range
Ejemplo n.º 2
0
	max_range = get_max_range()		

	modules.app_struct.I_GMODE("2")
	game_mode = get_game_mode()

	if game_mode.lower() == "a":
		modules.app_struct.I_INSTR("3","\nA random number will be generated from 1->10^r.\nYou're objective is to translate it to Japanese!")
		modules.app_struct.I_EX("Generated No. = 1350\nAnswer = 'Sen-sanbyaku-gojuu' or 'Sensanbyakugojuu'\n\nNote: For 4,7,9 please use 'yon','nana','kyuu' respectively.")
	else:
		modules.app_struct.I_INSTR("3","\nA random Japanese number will be generated from 1->10^r.\nYou're objective is to give its corresponding Arabic numerical equivalent!")
		modules.app_struct.I_EX("Generated JapNo. = 'Sen-sanbyaku-gojuu'\nAnswer = 1350\n\nNote: For 4,7,9 please use 'yon','nana','kyuu' respectively.")	

	modules.app_struct.I_CASE("4")
	modules.app_struct.I_QR("5")
	modules.app_struct.I_START("6")
	get_input()

	print "Ganbatte Kudasai! START!\n\n"

	user_answer = ""
	while 1==1:
		A = []
		G = randomize(randrange(1,3,1),max_range)
		g = G
		e = 0
		while G/10**e >= 10:
			e+=1
		i = 10**e
		while e != -1:
			if D[e][g/i] != 0:
				A.append(D[e][g/i])
Ejemplo n.º 3
0
Coded by: Joe Ferrer
Topic: Basic Programming Class
Github: gihub.com/joeferrer
Email: [email protected]
Project: ProgramAttic

What this code does: 
	Checks whether the input of a user is a palindrome or not
	i.e. whether the input and its reverse is equal.
'''

from modules.user_end import get_input


if __name__ == "__main__":
	
	print "Type your string: "
	string = get_input()
	i = 0 
	j = len(string)-1
	r = 1
	string = string.lower()
	while(i<j):
		if(string[i] != string[j]):
			print string + " is not a palindrome."
			r=0
			break
		i = i+1
		j = j-1
	if(r==1):
		print string + " is a palindrome."
Ejemplo n.º 4
0
import time
import getpass
import modules.connector
from modules.crs_tgwac_fxns import ugc_parser,tgwac,honor_eval
from modules.user_end import get_input, get_Y_N

if __name__ == "__main__":
	connector = modules.connector
	print "Enter CRS username: "******"Enter CRS password: "******"\nLogin Successful..."
		crawl_data = connector.site_crawl("https://crs.upd.edu.ph/viewgrades",site_opener)
		ugc_list = ugc_parser(connector.BeautifulSoup(crawl_data.read()))
		tgwa = tgwac(ugc_list)
		print "\nTGWAC Quick Analysis results say your Total GWA is " + str(tgwa)
		user_input = get_Y_N("Do you want to proceed to a more thorough evaluation?")
		if(user_input.upper()=="Y"):
			print "\nLoading subjects considered in TGWA computation..."
			time.sleep(2)
			for i in ugc_list:
				print i
				time.sleep(0.5)
			user_input = get_Y_N("From the subjects considered, are there any that shouldn't be counted?")
			if(user_input.upper()=="Y"):
				print "\nUsing the subjects listed above, type the subjects that must not be counted. (e.g. Math 17 THV)"
				takeouts = list()
				takingout = True
Ejemplo n.º 5
0
Email: [email protected]
Project: ProgramAttic

What this code does: 
	The main objective of this program is to convert a natural number entered by
	a user (taken as a base-10 number), to its corresponding base equivalents.
	Only bases 2->16 is considered. 
'''

from modules.user_end import get_input
from modules.math_ext import convert


if __name__ == "__main__":
	num = -1
	while(num < 0):
		print "Enter natural number to convert: "
		try:
			num = int(get_input())
			if(num<0):
				print "Bad input. Input must be >=0."
		except:
			print "Bad input. Try again."

	if(num == 0 or num == 1):
		print str(num) + " for all bases from 2-16."
	else:	
		for i in range(2,17):
			convert(num,i)

Ejemplo n.º 6
0
	modules.app_struct.I_INTRO("Tango Terminal Version","Joe Ferrer","*****@*****.**","github.com/joeferrer")
	modules.app_struct.I_GMODE("1")
	game_mode = get_game_mode()

	if game_mode.lower() == "a":
		modules.app_struct.I_INSTR("2","\nA random English word/phrase will be displayed.\nYou must first identify if the word is in Hiragana 'H' or Katakana 'F' or\n'FH' if in Katakana-Hiragana form or 'HF' if in Hiragana-Katakana form.\nThen, translate the word to Japanese.")
	else:
		modules.app_struct.I_INSTR("2","\nA random Japanese word/phrase will be displayed.\nYou must first identify if the word is in Hiragana 'H' or Katakana 'F' or\n'FH' if in Katakana-Hiragana form or 'HF' if in Hiragana-Katakana form.\nThen, translate the word to English.")

	modules.app_struct.I_NOTE("3.) ","\n\n","Note, if you use 'ee' for prolonged 'e' stick to doubling like that for all other cases such as 'oo' vice-versa.\nOtherwise, if you use 'ei' stick to doubling like that and for other cases like 'ou',vice-versa.\nExample: if 'oo' kookoosee NOT kookoosei.\n\nAlso note that 'masu' forms of verbs will not be accepted as the objective here is to know the dictionary form only.")
	
	modules.app_struct.I_CASE("4")
	modules.app_struct.I_QR("5")
	modules.app_struct.I_START("6")
	get_input()

	print "Ganbatte Kudasai! START!\n\n"


	F = open("_ext-files/vocabulary.txt")
	D = dict()
	while True:
		line = F.readline()
		if line == '':
			break
		line = line.strip('\n')
		parsed = line.split(";")
		e_str = parsed[0]
		j_str = parsed[1:len(parsed)]