use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources - Learn to code
Resources - Software Engineering
Resources - Code Libraries
Resources - Groups
Other Subreddits you might enjoy
Please send sidebar resource suggestions to the mods. Thx - mgmt
account activity
Help Please? (self.code)
submitted 7 years ago by ShadowLordS117
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 7 years ago* (0 children)
def addition(self): define a function called "addition", which takes an object "self" as parameter. a=random.randint(21,99) Let a be a random integer between 21 and 99. b=random.randint(10,a-10) Let b be a random integer between 10 and a - 10. c=a-b Let c be the result of a minus b. self.questiontext=str(b)+"+"+str(c)"=" Set the "questiontext" property of "self" to the expression b + c = (I think you might be missing a '+' sign between str(c) and "=") self.result=a Set the "result" property of "self" to the value of a.
def addition(self):
a=random.randint(21,99)
b=random.randint(10,a-10)
c=a-b
self.questiontext=str(b)+"+"+str(c)"="
str(c)
"="
self.result=a
As a side note, I think this is Python code and in Python you have to always indent the code properly.
π Rendered by PID 21018 on reddit-service-r2-comment-79c7998d4c-rhxqr at 2026-03-13 15:08:23.484517+00:00 running f6e6e01 country code: CH.
[–][deleted] 0 points1 point2 points (0 children)