Begin a new Kumite
Search
About
  • Filter by Language:
  • Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

    You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

    A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

Bioinformatics - The Reverse Compliment

What is DNA?

DNA is your (and every living thing's) genetic code. It has instructions about how to produce proteins that your body will use to digest nutrients, react to external stimuli, have back acne, etc.
DNA stands for deoxyribose nucleic acid, which is a molecule formed of a multitude of a smaller molecular unit, the nucleotide. A molecule
of DNA will consist of two strands of nucleotides, annealed together.
We will explore how DNA actually dictates what proteins are formed later, for now let's learn the
basics of DNA.

Nucleotides

Nucleotides make up a sequence of DNA. This unique sequence is what makes you different from
Jeff and Jeff different from his mother. The uniqueness of your DNA sequence (about 3 billion
nucleotides long) is enough to distinguish you from any other human. While the DNA sequences of any two humans are
typically a fraction of a percent different, this fraction of a percent difference is responsible for
all sorts of diversity in the human population. For example, height, eye color, hair color, nose shape, skin tone are all determined genetically.
Deviations in this sequence across generations is what drives evolution.

Nucleotides come in four flavors: adenine, guanine, cytosine, and thymine. Or A, G, C and T for short.
In bioinformatics problems, we would call "AGCT" our alphabet.

Complimentary Strands

When biologists record the DNA sequence of an organism (done with next-generation sequencing technology),
it is stored as a string of letters: ATGCTAGTA. But this neglects that the molecule is double-stranded,
how could they leave out the information on the other strand? The answer is because the sequence of one strand can be implied from the other.
DNA strands only anneal together if they are complimentary, which is because only certain nucleotides fit together based
on their molecular structure. For example, A can only complement T and vice versa while G can only compliment C.
This property of DNA allows your cells to make copies of their DNA and pass it on to a newly generated cell.

For example the DNA molecule:

ATGGCATGA
TACCGTACT

Notice that only A's and T's can be across from each other while only G's and C's can only be across from each other.

DNA is antiparallel

In addition to being double-stranded and having complimentary strands, DNA also has directionality.
This is because DNA has to be read in a sequence for meaning to be understood, similarly to human languages.
For example, we read and write english from left to right. DNA is exactly the same, but it is read from 5' to 3' (5 prime to 3 prime)
These directions are implied by the structure of the nucleotides and we can leave that detail out. But know that each strand is read in the opposite direction.
Another way to say this is that the strands are 'antiparallel'. So the above DNA example rewritten with directions:

5'-ATGGCATGA-3'
3'-TACCGTACT-5'

Notice how the top strand starts at 5' and goes to 3'. If we were to read information on the bottom strand, we would actually be reading it backward from how it appears above, like this:

5'-TCATGCCAT-3'

Problem: The reverse compliment

Can you write a function that will take in a strand of DNA and output it's complimentary strand in the 5' --> 3' direction?
This is what biologists call the 'reverse compliment'.
For example:

5'-ATGGCATGA-3' --> 5'-TCATGCCAT-3'

def reverse_compliment(dna):
    pass
Code
Diff
  • isEven=x=>_(x)                                                                                                                                       
    
  • 1
    isEven=x=>!(x&1)
    
    1+
    isEven=x=>_(x)                                                                                                                                       
    

Recent Moves:

Code
Diff
  • int addition(int a, int b) => a + b;
  • 1
    int addition(int a, int b){
    
    2
      return a+b;
    
    3
    }
    
    1+
    int addition(int a, int b) => a + b;
    

Recent Moves:

Code
Diff
  • let hello = { print("Hello Swift 5!") }
    
  • 1
    func hello(){print("Hello Swift 5!")}
    
    1+
    let hello = { print("Hello Swift 5!") }
    

1e2, obfuscated

Code
Diff
  • def returnhundred(*arg): 
    	import textwrap
    	return eval(''.join([chr(i) for i in [b-i for i in [int(i) for i in textwrap.wrap(str(520051), 2)] for b in [sum([int(i) for i in textwrap.wrap(str(520051), 2)])-2]*3]])[::3])
  • 1
    def returnhundred(*_):
    
    2
        return int(''.join(list(map(lambda x: str(int(x)), [True, False, False]))))
    
    3
        
    
    4
        
    
    5
        
    
    6
        
    
    7
        
    
    8
        
    
    9
        
    
    10
        
    
    11
        
    
    12
        
    
    13
        
    
    14
        
    
    15
        
    
    16
      
    
    17
      
    
    18
      
    
    1+
    def returnhundred(*arg): 
    
    2+
    	import textwrap
    
    3+
    	return eval(''.join([chr(i) for i in [b-i for i in [int(i) for i in textwrap.wrap(str(520051), 2)] for b in [sum([int(i) for i in textwrap.wrap(str(520051), 2)])-2]*3]])[::3])
    

Recent Moves:

potatoguy32Failed Tests

Hangman

Fundamentals

Hangman game:
Choose a random programming language and make a hangman game the most natural possible
Rules:

  • Only 8 lives
  • Only lower letters
  • If the letter is not in the word you lose a life
  • Repeated or invalid letters don't take lives

I haven't make special test so it would be useful too.

:D

from random import choice

print("H A N G M A N")

answer = ""
words = ['python', 'java', 'kotlin', 'javascript', 'go', 'rust', 'sacala',
        'ruby', 'swift', 'factor']

while answer != "exit":
    answer = input('Type "play" to play the game, "exit" to quit: \n')
    if answer == "play":
        test = choice(words)
        lines = ["-" for part in range(len(test))]
        lives = 8
        repeated = []

        while lives > 0:
            print("".join(lines))
            attemp = input("input a letter: ")
            if attemp in repeated:
                print("You already typed this letter\n")
                continue
            elif len(attemp) != 1:
                print("You should input a single letter\n")
                continue
            elif (attemp.isupper()) or (attemp.isalpha() is False):
                print("It is not an ASCII lowercase letter\n")
                continue
            if attemp in test:
                for count, letter in enumerate(list(test)):
                    if letter == attemp:
                        lines[count] = attemp
            else:
                print("No such letter in the word")
                lives = lives - 1
            if ("".join(lines)) == test:
                print(f"You guessed the word {''.join(lines)}!\nYou survived!")
                break
            if lives == 0:
                print("You are hanged!")
                break
            repeated.append(attemp)
            print()

    elif (answer != "play") and (answer != "exit"):
        continue
NSO2008Failed Tests

A Chatbot

A simple chatbot designed to just respond to only 3 statements, for now. I saved the language as javascript, but if you paste in your SDE, it will respond as it should.

License: Only to be used personally, not to be published on a public site. You may not edit the name at the bottom.

<html>
<head>
	<script>
		var know = {
            "What is your name?":"I'm Batman... Just joking, I am Chatbot 1.0, designed to chat with you. So? What are you waiting for? Talk to me!",
            "Who built you?":"What is your business? Anyway, for what it's worth, I was designed by Ndubisi Obidigbo, Mainly in Javascript. You happy?",
            "he":"her"
        };
        function talk() {
			var user = document.getElementById("userBox").value;
			document.getElementById("chatLogs").innerHTML += "You: " + user + "<br>";
            if (user in know) {
                document.getElementById("chatLog").innerHTML += "Bot: " + know[user] + "<br>";
            } else {
                document.getElementById("chatLog").innerHTML += "Bot: I wasn't programmed to respond to such... Please say something I can understand.<br>";
			};
			
		var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+'| '+time;
document.getElementById("timeDate").innerHTML = dateTime;
		};
	</script>
    <style>
        body {
  font-family: sans-serif !important;
}
.bg-funky	{
  background-image: linear-gradient(to left, rgb(215, 246, 253), rgb(166, 230, 245), rgb(166, 245, 238));
}	

.heading {
  color: #fff;
  margin: 30px;
  font-weight: 600;
}

img {max-width: 100%;}
		.inbox_msg {
		  border: 1px solid #c4c4c4;
		  clear: both;
		  overflow: hidden;
		}
		.top_spac{ margin: 20px 0 0;}


		.recent_heading {float: left; width:40%;}

		.headind_srch{ padding:10px 29px 10px 20px; overflow:hidden; border-bottom:1px solid #c4c4c4;}

		.recent_heading h4 {
		  color: #05728f;
		  font-size: 21px;
		  margin: auto;
		}

		.chat_ib h5{ font-size:15px; color:#464646; margin:0 0 8px 0;}
		.chat_ib h5 span{ font-size:13px; float:right;}
		.chat_ib p{ font-size:14px; color:#989898; margin:auto}
		.chat_img {
		  float: left;
		  width: 11%;
		}
		.chat_ib {
		  float: left;
		  padding: 0 0 0 15px;
		  width: 88%;
		}

		.chat_people{ overflow:hidden; clear:both;}
		.chat_list {
		  border-bottom: 1px solid #c4c4c4;
		  margin: 0;
		  padding: 18px 16px 10px;
		}
		.inbox_chat { height: 550px; overflow-y: scroll;}

		.active_chat{ background:#ebebeb;}

		.incoming_msg_img {
		  display: inline-block;
		  width: 6%;
		}
		.received_msg {
		  display: inline-block;
		  padding: 0 0 0 10px;
		  vertical-align: top;
		  width: 92%;
		 }
		 .received_withd_msg {
		  background: #e4e8fb none repeat scroll 0 0;
		  border-radius: 3px;
		  color: #646464;
		  font-size: 14px;
		  margin: 0;
		  padding: 5px 10px 5px 12px;
		  width: 100%;
		}
		.time_date {
		  color: #747474;
		  display: block;
		  font-size: 10px;
		  margin: 3px 0 0;
		}
		.received_withd_msg { width: 70%;}
		.mesgs {
		  float: left;
		  padding: 40px;
		}

		 .sent_msg {
		  background: #3F51B5 none repeat scroll 0 0;
		  border-radius: 3px;
		  font-size: 14px;
		  margin: 0; color:#fff;
		  padding: 5px 10px 5px 12px;
		  width:100%;
		}
		.outgoing_msg{ overflow:hidden; margin:26px 0 26px;}
		.sent_msg {
      float: right;
		  width: 70%;
      text-align: right;
		}
		.input_msg_write input {
		  background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
		  border: medium none;
		  color: #4c4c4c;
		  font-size: 15px;
		  min-height: 48px;
		  width: 100%;
		}

		.type_msg {border-top: 1px solid #c4c4c4;position: relative;}
		.msg_send_btn {
		  background: #05728f none repeat scroll 0 0;
		  border: medium none;
		  border-radius: 50%;
		  color: #fff;
		  cursor: pointer;
		  font-size: 17px;
		  height: 33px;
		  position: absolute;
		  right: 0;
		  top: 11px;
		  width: 33px;
		}
		.messaging { background: #fff;}
		.msg_history {
		  max-height: 516px;
		  overflow-y: auto;
		}

.credit {
  margin-bottom: 20px;
  margin-top: 20px;
}

.credit a {
  color: #fff;
  font-weight: 300;
  letter-spacing: 2px;
  border-bottom: dotted 1px;
}

.inPut {
	width: 500px;
}
    </style>

</head>
<body class="bg-funky">
<div class="container">
<h3 class="heading text-center">Lucy</h3>
<div class="messaging">
      <div class="inbox_msg">

        <div class="mesgs">
          <div class="msg_history">
            <div class="incoming_msg">
              <div class="incoming_msg_img"> <img src="https://ptetutorials.com/images/user-profile.png" alt="sunil"> </div>
              <div class="received_msg">
                <div class="received_withd_msg" id="chatLog">
                  <p></p>
                  <span class="time_date" id="timeDate"></span></div>
              </div>
            </div>
            <div class="outgoing_msg">
              <div class="sent_msg" id="chatLogs">
                <p class=""></p>
                <span class="time_date" id="timeDate"></span> </div>
            </div>
            <p><textarea type="text" id="userBox" onkeydown="if (event.keyCode == 13) {talk()}" placeholder="Ask Lucy" class="inPut"></textarea></p>
              </div>
            </div>
          </div>

        </div>
      </div>
    
  </div>
  
  <div class="credit text-center">
    <i>Made by Ndubisi Obidigbo</i>
  </div>
  </body>
  </html>