HackerRank-Python(90)
-
Prepare > Python > Strings > String Validators
String Validators | HackerRank Identify the presence of alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters in a string. www.hackerrank.com 문제 You are given a string S. Your task is to find out if the string S. contains: alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters. => S라는 문자열이 주어질건데, 알파벳과 숫자의 조합, 알파벳, 숫자, 소..
2023.07.08 -
Prepare > Python > Strings > Find a string
Find a string | HackerRank Find the number of occurrences of a substring in a string. www.hackerrank.com 문제 Output the integer number indicating the total number of occurrences of the substring in the original string. => 원래 문자열에서 하위 문자열의 총 발생 횟수를 나타내는 정수를 출력합니다. 코드 def count_substring(string, sub_string): number = 0 for i in range(len(string)): if string[i:i+len(sub_string)] == sub_string: numbe..
2023.07.06 -
Prepare > Python > Basic Data Types > Tuples
Tuples | HackerRank Learn about tuples and compute hash(T). www.hackerrank.com 문제 Given an integer, n, and n space-separated integers as input, create a tuple,t , of those n integers. Then compute and print the result of hash(t). => 정수 n과 공백으로 구분된 n개의 정수가 입력값으로 주어지면 해당 n개의 정수로 구성된 튜플 t를 생성합니다. 그런 다음 hash(t)의 결과를 계산하고 인쇄합니다. 코드 if __name__ == '__main__': n = int(input()) integer_list = map(int, i..
2023.07.05 -
Prepare > Python > Strings > Find a string
Find a string | HackerRank Find the number of occurrences of a substring in a string. www.hackerrank.com 문제 In this challenge, the user enters a string and a substring. You have to print the number of times that the substring occurs in the given string. String traversal will take place from left to right, not from right to left. => string에서 substring이 몇 번 포함돼있는지 세라 예시를 보면, 한 문자가 여러번 카운트 될 수 있음. ..
2023.07.04 -
Prepare > Python > Strings > Mutations
Mutations | HackerRank Understand immutable vs mutable by making changes to a given string. www.hackerrank.com 문제 Read a given string, change the character at a given index and then print the modified string. # INPUT abracadabra 5 k => "abracadabra"의 5번 인덱스를 'k'로 바꾸어 출력하라. 코드 def mutate_string(string, position, character): return string[:position] + character + string[position+1:] if __name__ ==..
2023.07.02 -
Prepare > Python > Strings > What's Your Name?
What's Your Name? | HackerRank Python string practice: Print your name in the console. www.hackerrank.com 문제 You are given the firstname and lastname of a person on two different lines. Complete the print_full_name function in the editor below. => 이름 완성해서 Hello firstname lastname! You just delved into python. 위 형식으로 출력해라 코드 def print_full_name(first, last): print( f"Hello {first} {last}! You jus..
2023.06.30 -
Prepare > Python > Strings > String Split and Join
https://www.hackerrank.com/challenges/python-string-split-and-join/problem?isFullScreen=true String Split and Join | HackerRank Use Python's split and join methods on the input string. www.hackerrank.com 문제 You are given a string. Split the string on a " " (space) delimiter and join using a - hyphen. 코드 def split_and_join(line): # write your code here line = line.split(" ") return "-".join(line)..
2023.06.29