본문 바로가기

코딩테스트/해커랭크6

[easy] Python if-Else (with Python) *Task* Given an integer, N, perform the following conditional actions: If N is odd, print Weird If N is even and in the inclusive range of 2 to 5 , print Not Weird If N is even and in the inclusive range of 6 to 20, print Weird If N is even and greater than 20, print Not Weird *Input Format* A single line containing a positive integer, N *Output Format* 더보기 #!/bin/python3 import math import os i.. 2022. 9. 30.
[easy] The World of Numbers(with shell) *problem* Given two integers, and , find their sum, difference, product, and quotient. *Input Format* Two lines containing one integer each ( and , respectively). *Output Format* Four lines containing the sum (), difference (), product (), and quotient (), respectively. (While computing the quotient, print only the integer part.) *Answer* 더보기 read x; read y; echo "$((x+y))"; echo "$((x-y))"; ech.. 2022. 9. 29.
[easy]Looping with Numbers(with shell) *problem* Use a for loop to display the natural numbers from to . *Input Format* There is no input *Output Format* *Answer" 더보기 2022. 9. 29.
[easy]A personalized Echo (with shell) *Problem* Write a Bash script which accepts as input and displays the greeting "Welcome (name)" *Input Format* There is one line of text, . *Output Format* One line: "Welcome (name)" (quotation marks excluded). The evaluation will be case-sensitive. *Answer* 더보기 - read는 표준 입력(파이프라인 입력 또는 키보드 입력)에서 한 줄의 내용씩 읽어 들이는 명령어 2022. 9. 29.
[easy]Looping and Skipping (with Shell) *Problem* Your task is to use for loops to display only odd natural numbers from to . *Input Format* There is no input. *Output Format* *정답* 더보기 2022. 9. 29.
[easy]Say "Hello, World!" With Python Check Tutorial tab to know how to to solve. Here is a sample line of code that can be executed in Python: print("Hello, World!") You can just as easily store a string as a variable and then print it to stdout: my_string = "Hello, World!" print(my_string) The above code will print Hello, World! on your screen. Try it yourself in the editor below! Input Format You do not need to read any input in .. 2022. 9. 29.