Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

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.

Ad
Ad
from random import randint
quotes= ["Captain Teemo on duty.","Yes, sir!", "Armed and ready.","Reporting in.","Hut, two, three, four.","I'll scout ahead!","Swiftly!","That's gotta sting.","Never underestimate the power of the Scout's code.","Size doesn't mean everything."]
def motivation():
    return quotes[randint(0,len(quotes)-1)]
Debugging

Task

  • Debug the authenticated_request function. There are several bugs in this code preventing it from executing correctly. If properly debugged, it will autheniticate the request to the given url, and return a 200 HTTP response status code (which means there was a successfful response).

Rule

  • Do not edit the URL constant in the Code or Preloaded tab. The purpose of this kumite is to debug the code within the authenticated_request method, and generated a 200 response code to this given url.

Hint

Click to view
  • You must look at the URL constant in the Preloaded tab to successfully debug this.
  • There is an incorrect: data structure, method, and parameter.
import requests



def authenticated_request():
    credentials = {'username': 'seraph', 'password': 'secret'}
    try:
        response = requests.post(url=URL, data=credentials)

    except (ValueError, NameError, TypeError) as e:
        return False
    else:
        return response.status_code == 200
def get_of_my_lawn(on_my_lawn):
    if on_my_lawn:
        return "get of my lawn"
Data Science
Mathematics

Background information

Time is measured differently on each planet. One Earth year is equivalent to the amount of
time it takes for Earth to orbit the sun. On other planets, this orbital time is shorter or longer.

image

Planet Rotation period (hours) Orbit period (days)
Mercury 58.6 88.0
Venus 243 224.7
Earth .99 365.25
Mars 1.03 687
Jupiter .41 4331
Saturn .45 10747
Uranus .72 30589
Neptune .67 59800
Pluto 6.39 90560

Task

Create a function named planetary_age that takes two parameters, planet, and age which are str, and int respectively. The function should calculate your age on other planets.

def planetary_age(planet, age):
    hashmap = {
        'mercury': {'rotation': 58.6, 'revolution': 88.0},
        'venus': {'rotation': 243, 'revolution': 224.7},
        'earth': {'rotation': .99, 'revolution': 365.25},
        'mars': {'rotation': 1.03, 'revolution': 687},
        'jupiter': {'rotation': .41, 'revolution': 4331},
        'saturn': {'rotation': .45, 'revolution': 10747},
        'uranus': {'rotation': .72, 'revolution': 30589},
        'neptune': {'rotation': .67, 'revolution': 59800},
        'pluto': {'rotation': 6.39, 'revolution': 90560}
    }

    earth_days = age * hashmap['earth']['revolution']
    planet_age = earth_days / hashmap[planet]['revolution']
    days = earth_days / hashmap[planet]['rotation']
    return planet_age, days
def find_what(txt):
    if txt.find('Python'):
        return 'Found Python!'
    else:
        return 'Python not found!'
def solution():
    return 10

return:
w - h - y

def why():
    return 'w - h - y'

Find the largest number from the string and output in the number format

def my_first_kumite(s):
    s = list(s)
    for i in range(len(s)):
        s[i] = int(s[i])
    return max(s)

your task:
return a max lenght word in line, but return len word without another symbols

example:
- 'marry, ksnfgjji233jc, harry!@#':
ksnfgjji233jc, - len this word is 14, len word without another symbols = 10 (ksnfgjjijc)
should return: ksnfgjji233jc,

def lenght_line(line='marry, ksnfgjji233jc, harry!@#'):
    return 'ksnfgjji233jc,'

You must return a string value from the list. Good luck!

def search_str(s):
    for i in s:
        if isinstance(i, str):
            return i