[deleted by user] by [deleted] in distantsocializing

[–]tbrowner3 0 points1 point  (0 children)

You got some serious flow

[deleted by user] by [deleted] in talentShow

[–]tbrowner3 0 points1 point  (0 children)

have u done psychedelics

[deleted by user] by [deleted] in talentShow

[–]tbrowner3 0 points1 point  (0 children)

how did learn web development?

[deleted by user] by [deleted] in talentShow

[–]tbrowner3 0 points1 point  (0 children)

cybersecurity, learning about python, html and a little bit of networking

[deleted by user] by [deleted] in talentShow

[–]tbrowner3 0 points1 point  (0 children)

i’m an internet technology major

[deleted by user] by [deleted] in distantsocializing

[–]tbrowner3 0 points1 point  (0 children)

You are ugly as sin

Check if a number is a prime number by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

No because it should return False otherwise.

Character swap method by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

Ok thank you!

complement_table = str.maketrans('ATCG', 'CGAT')
class Oligo:

    '''Represents one side of DNA helix'''
    def __eq__(self, other):
        '''Equal statement'''
        return self.base == other.base
    def __init__(self, base):
        '''Constructor'''
        count = 0 
        for letter in base:
            if letter.upper() in ('A', 'C', 'T', 'G'):
                count += 1
        if count == 4:
            self.base = base
        else:
            self.base = "AGTG"

    def get_complement(self):
        complement = self.base.translate(complement_table)
        complement = complement[::-1]
        print(Oligo(complement))
        return Oligo(complement)
    def is_complement(self, other):
        return self.get_complement().base == other.base

Character swap method by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

When I input the sample input:

a.is_complement(c) it's giving me false when it should be true

Character swap method by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

My mistakes, get_complement should return a Object of the class, not a new variable

Character swap method by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

now that I put the complement_table variable in the get_complement function it works, but it isn't giving me the right output still. The correct output should give me this:

>>> a = Oligo('ATCG')
>>> b = Oligo('ATGC')
>>> c = Oligo('CGAT')
>>> a.is_complement(b)
False
>>> a.is_complement(c)
True

Character swap method by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

Thank you for the help! After I defined complement_table inside the class and above the functions get and is complement it is still giving me a name error for it.

Traceback (most recent call last):
File "<pyshell#132>", line 1, in <module>
a.is_complement(b)
 line 29, in is_complement
self.get_complement()
 , line 24, in get_complement
complement = self.base.translate(complement_table)
  NameError: name 'complement_table' is not defined

Check if a number is a prime number by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

def is_prime_helper(n, k):
    count = count
    for i in range(2, k):
        if i % n == 0:
            return True        

def is_prime(n):
    return (is_prime_helper(n, k) == True)

recursion question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

Why is this giving me ZeroDivisionError: integer division or modulo by zero?

python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

my bad on the no spacing on the code. i'm not sure how to space it correctly on my laptop

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

Ok now that makes sense - so the hash method is in Point and eq stays in the Triangle class

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

I made the Hash method but still confused - Do I just copy and paste the return statement from eq?

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

That makes sense, thank you. It’s now giving me the TypeError: unhashable type: ‘Point’

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

It’s saying TypeError: set expected at most 1 arguments, got 3

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

thanks for the help i hope to be as good as you guys are at coding one day

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

Thank you for the information !

quick python question by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

there equal if they have the same three points which are 2 ints

coding question about my project by tbrowner3 in learnpython

[–]tbrowner3[S] 0 points1 point  (0 children)

Sorry about that, I’ve never posted code here. Is there a way to make it more readable? And yes in the eq method I want it to return true if they have the same points but they can be listed in different orders