User talk:Habreno/Wizardry

def main:
 * Wiz = input("Wizardry Value: ")
 * try:
 * wiz = int(Wiz)
 * except:
 * wiz = romantodec(Wiz)
 * wiz = wiz*25
 * if wiz == 1:
 * print("This item grants the wearer", wiz ,"spellpoint. Favored Souls and Sorcerers gain up to double spellpoints from items.")
 * else:
 * print("This item grants the wearer", wiz ,"spellpoints. Favored Souls and Sorcerers gain up to double spellpoints from items.")

Note: The romantodec function isn't copied here for space reasons; it basically converts the roman numeral to an integer.

For those unfamiliar with Python, if/else statements (actually if/elif/else statements, but if/else is a simpler form) check the condition on the if- if it's true, then the code under the if is executed. If it's not true, the else is executed. (in if/elif/else, if the initial if fails, elifs are then checked in the order they're listed, top to bottom, and if all those fail, then the else is executed)

In the case of try/except statements, they have the try be executed, and if an error happens, then the excepts are tried. You can have multiple excepts with various conditions (similar to elifs), which each do various different things. A generic except acts as an else- if the try and the specific excepts fail, then the generic except is carried out. Try/excepts are basically another form of if/elif/else statements.

So the main thing I don't know of in Wikicode are if/else and try/except statements, and I'm not sure what a good resource to look for them is. Habreno (Contribs • Message • Email ) 17:26, February 15, 2016 (EST)