We give a definition of weakn-categories based on the theory of operads. We work with operads having an arbitrary setSof types, or "S-operads," and given such an operadO, we denote its set of operations by elt(O). Then for anyS-operadOthere is an elt(O)-operadO+whose algebras areS-operads overO. LettingIbe the initial operad with a one-element set of types, and definingI0+=I,I(i+1)+=(Ii+)+, we call the operations ofI(n-1)+the "n-dimensional opetopes." Opetopes form a category, and presheaves on this category are called "opetopic sets." A weakn-category is defined as an opetopic set with certain properties, in a manner reminiscent of Street's simplicial approach to weakω-categories. Similarly, starting from an arbitrary operadOinstead ofI, we define "n-coherentO-algebras," which arentimes categorified analogs of algebras ofO. Examples include "monoidaln-categories," "stablen-categories," "virtualn-functors" and "representablen-prestacks." We also describe hown-coherentO-algebra objects may be defined in any (n+1)-coherentO-algebra.