diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-01-31 16:22:52 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-01-31 16:22:52 +0000 |
commit | 45b06ac98819bfcad5f490c580d25fb0bf90c8ad (patch) | |
tree | 4f00b8a96847bccc605eea0e7154a3bd36a2fb5a /comp/work/41 | |
parent | 00e419fa183247d6d94b7eaf274bd2ae6225c646 (diff) | |
parent | 02653ab40d93fb7e6d07edb747fe0e07c5d60c74 (diff) |
performing merge
Merge branch 'master' of git://git.seacrossedlovers.xyz/school
Diffstat (limited to 'comp/work/41')
-rw-r--r-- | comp/work/41/exersise.py | 24 | ||||
-rw-r--r-- | comp/work/41/starter.txt | 5 |
2 files changed, 29 insertions, 0 deletions
diff --git a/comp/work/41/exersise.py b/comp/work/41/exersise.py new file mode 100644 index 0000000..2633c4c --- /dev/null +++ b/comp/work/41/exersise.py @@ -0,0 +1,24 @@ +def getdigits(number): + digits = [] + for i in number: + digits.append(int(i)) + return digits + +def testnumber(number): + d = getdigits(number) + total = sum(d) + + if (int(number) % total) == 0: + return True + return False + +n = int(input("which harshad number should you go to: ")) + +count = 0 +i = 0 +while count < n: + i += 1 + if testnumber(str(i)): + count += 1 + +print(i) diff --git a/comp/work/41/starter.txt b/comp/work/41/starter.txt new file mode 100644 index 0000000..e7328a1 --- /dev/null +++ b/comp/work/41/starter.txt @@ -0,0 +1,5 @@ +1) bundling data with relevant functions to do with the data +2) a class is the blueprint for an object, it will contain atributes (variables), and methods (functions) that can be used to manipulate/set or retrive the atributes +3) an object is the instance of a class in memory, it can be treated as a variable +4) this is the creation of an object from a class, it will often contain an initilization function to allow for it to have starting values +5) inheritence is the concept of creating a subclass that contains the same methods and atributes as an existing object and more data, it is a derived class |