HackerRank-Python(90)
-
Prepare > Python > Built-Ins > Python Evaluation
Python Evaluation | HackerRank Evaluate the expressions in Python using the expression eval(). www.hackerrank.com 문제 Task You are given an expression in a line. Read that line as a string variable, such as var, and print the result using eval(var). => eval() 을 이용해 결과를 출력해라 코드 eval(input()) 노트 print(eval(input())) """ 5 None """ input으로 받아온게 "print(2 + 3)" 이므로 eval로 실행한 뒤 남는게 없기에 None 출력 참조 Prepa..
2023.09.28 -
Prepare > Python > Built-Ins > Input()
Input() | HackerRank A Python 2 challenge: Input() is equivalent to eval(raw_input(prompt)). www.hackerrank.com 문제 Task You are given a polynomial P of a single indeterminate (or variable), x. You are also given the values of x and k. Your task is to verify if P(x)=k. Input Format The first line contains the space separated values of x and k. The second line contains the polynomial P. Output For..
2023.09.27 -
Prepare > Python > Built-Ins > Zipped!
Zipped! | HackerRank Compute the average by zipping data. www.hackerrank.com 문제 Task The National University conducts an examination of N students in X subjects. Your task is to compute the average scores of each student. Input Format The first line contains N and X separated by a space. The next X lines contains the space separated marks obtained by students in a particular subject. Output Form..
2023.09.26 -
Prepare > Python > Collections > Company Logo
Company Logo | HackerRank Print the number of character occurrences in descending order. www.hackerrank.com 문제 A newly opened multinational brand has decided to base their company logo on the three most common characters in the company name. They are now trying out various combinations of company names and logos based on this condition. Given a string , which is the company name in lowercase let..
2023.09.25 -
Prepare > Python > Collections > Piling Up!
Piling Up! | HackerRank Create a vertical pile of cubes. www.hackerrank.com 문제 STDIN Function ----- -------- 2 T = 2 6 blocks[] size n = 6 4 3 2 1 3 4 blocks = [4, 3, 2, 1, 3, 4] 3 blocks[] size n = 3 1 3 2 blocks = [1, 3, 2] """ Yes No """ => n개로 이뤄진 블럭 묶음을 보고 피라미드(아래있는 블럭이 위 블럭보다 짧으면 안됨)구조로 쌓을 수 있는지 판별해야함 블럭 묶음에서 뺄 수 있는 블럭은 양 끝에 존재하는 블럭임 T개의 블럭 묶음이 주어질것 각 블럭 묶음은 n개의 블럭으로 이뤄짐 블럭 묶음은 블럭들의 길이들로 표..
2023.09.22 -
Prepare > Python > Collections > Word Order
Word Order | HackerRank List the number of occurrences of the words in order. www.hackerrank.com 문제 You are given n words. Some words may repeat. For each word, output its number of occurrences. The output order should correspond with the input order of appearance of the word. See the sample input/output for clarification. Input Format The first line contains the integer, n. The next n lines eac..
2023.09.22 -
Prepare > Python > Itertools > Compress the String!
Compress the String! | HackerRank groupby() www.hackerrank.com 문제 You are given a string S. Suppose a character 'c' occurs consecutively X times in the string. Replace these consecutive occurrences of the character 'c' with (X, c) in the string. Input Format A single line of input consisting of the string S. Output Format A single line of output consisting of the modified string. Constraints All..
2023.09.20