HackerRank-Python(90)
-
Prepare > Python > Strings > sWAP cASE
https://www.hackerrank.com/challenges/swap-case/problem?isFullScreen=true 문제 You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa. => 주어진 문자를 대소문자 바꿔서 출력하라. 코드 def swap_case(s): fin = "" for i in s: if i.islower() == True: fin = fin + i.upper() elif i.isupper() == True: fin = fin + i.lower() else: fin = fin + i r..
2023.06.28 -
Prepare > Python > Basic Data Types > Lists
Lists | HackerRank Perform different list operations. www.hackerrank.com 문제 onsider a list (list = []). You can perform the following commands: insert i e: Insert integer e at position i. print: Print the list. remove e: Delete the first occurrence of integer e. append e: Insert integer e at the end of the list. sort: Sort the list. pop: Pop the last element from the list. reverse: Reverse the l..
2023.06.27 -
Prepare > Python > Basic Data Types > Finding the percentage
Finding the percentage | HackerRank Store a list of students and marks in a dictionary, and find the average marks obtained by a student. www.hackerrank.com 문제 he provided code stub will read in a dictionary containing key/value pairs of name:[marks] for a list of students. Print the average of the marks array for the student name provided, showing 2 places after the decimal. 코드 if __name__ == '..
2023.06.26 -
Prepare > Python >Basic Data Types > Nested Lists
Nested Lists | HackerRank In a classroom of N students, find the student with the second lowest grade. www.hackerrank.com 문제 Given the names and grades for each student in a class of N students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade. Note: If there are multiple students with the second lowest grade, order their names alphabetically and..
2023.06.24 -
Prepare > Python > Basic Data Types > List Comprehensions
List Comprehensions | HackerRank You will learn about list comprehensions. www.hackerrank.com 문제 Let's learn about list comprehensions! You are given three integers x,y and z representing the dimensions of a cuboid along with an integer n. Print a list of all possible coordinates given by (i, j, k) on a 3D grid where the sum of i+j+k is not equal to n. Here, 0
2023.06.17 -
Prepare > Python > Introduction
Python If-Else if n%2 != 0: print('Weird') else: if n 20: print('Not Weird') else: print('Weird') Arithmetic Operators print(a + b) print(a - b) print(a * b) Loops for i in range(n): print(i**2) Write a function if year % 400 == 0: leap = True elif (year % 100 != 0 and year % 4 == 0): leap = True return leap 문제 이해 똑바로...영문 독해 이슈 ㅋㅋㅋ Print Function def replyer(n): for i in range(1, n+1): print(i,..
2023.06.17