Skip to content

Commit a54e9ab

Browse files
authored
Merge pull request #2 from alexprut/algo
Python Introduction problems
2 parents 9629192 + 719f55d commit a54e9ab

File tree

8 files changed

+48
-1
lines changed

8 files changed

+48
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
if __name__ == '__main__':
2+
a = int(input())
3+
b = int(input())
4+
print(a+b)
5+
print(a-b)
6+
print(a*b)

Python/Introduction/Loops/Solution.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if __name__ == '__main__':
2+
n = int(input())
3+
for i in range(0, n):
4+
print(i*i)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if __name__ == '__main__':
2+
n = int(input())
3+
for i in range(1, n+1):
4+
print(i, end = "")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/python3
2+
3+
N = int(input())
4+
5+
if N % 2 != 0:
6+
print("Weird")
7+
elif N % 2 == 0 and 2 <= N and N <= 5:
8+
print("Not Weird")
9+
elif N % 2 == 0 and 6 <= N and N <= 20:
10+
print("Weird")
11+
elif N % 2 == 0 and N >= 20:
12+
print("Not Weird")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if __name__ == '__main__':
2+
a = int(input())
3+
b = int(input())
4+
print(a//b)
5+
print(a/b)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello, World!")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def is_leap(year):
2+
return year % 4 == 0 and (year % 400 == 0 or year % 100 != 0)
3+

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
22
<img src="https://github.com/alexprut/HackerRank/raw/master/hackerrank-logo.png" width="450" height="auto"/>
33

4-
[![Solutions](https://img.shields.io/badge/solutions-359-green.svg?style=flat-square)](https://github.com/alexprut/HackerRank#table-of-contents)
4+
[![Solutions](https://img.shields.io/badge/solutions-366-green.svg?style=flat-square)](https://github.com/alexprut/HackerRank#table-of-contents)
55
[![Languages](https://img.shields.io/badge/languages-c%2B%2B%2Cjava%2Chaskell-yellow.svg)](https://github.com/alexprut/HackerRank#table-of-contents)
66
[![Author](https://img.shields.io/badge/author-alexprut-brightgreen.svg?style=flat-square)](https://www.hackerrank.com/alexprut)
77
[![MIT](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)](https://github.com/alexprut/HackerRank/blob/master/LICENSE)
@@ -34,6 +34,7 @@ platform tests of a given problem.
3434
1. [Functional Programming](#functional-programming)
3535
1. [Java](#java)
3636
1. [C++](#c++)
37+
1. [Python](#python)
3738
1. [Distributed Systems](#distributed-systems)
3839
1. [Mathematics](#mathematics)
3940
1. [Artificial Intelligence](#artificial-intelligence)
@@ -387,6 +388,17 @@ platform tests of a given problem.
387388
|Other Concepts|[Preprocessor Solution](https://www.hackerrank.com/challenges/preprocessor-solution)|Easy|25|[Solution.cpp](C++/Other%20Concepts/Preprocessor%20Solution/Solution.cpp)|
388389
|Other Concepts|[Overload Operators](https://www.hackerrank.com/challenges/overload-operators)|Easy|30|[Solution.java](C++/Other%20Concepts/Overload%20Operators/Solution.java)|
389390

391+
## Python
392+
|Subdomain|Challenge|Difficulty|Score|Solution|
393+
|-|-|-|-|-|
394+
|Introduction|[Say "Hello, World!" With Python](https://www.hackerrank.com/challenges/py-hello-world)|Easy|5|[Solution.py](Python/Introduction/Say%20"Hello,%20World!"%20With%20Python/Solution.py)|
395+
|Introduction|[Python If-Else](https://www.hackerrank.com/challenges/py-if-else)|Easy|10|[Solution.py](Python/Introduction/Python%20If-Else/Solution.py)|
396+
|Introduction|[Arithmetic Operators](https://www.hackerrank.com/challenges/python-arithmetic-operators)|Easy|10|[Solution.py](Python/Introduction/Arithmetic%20Operators/Solution.py)|
397+
|Introduction|[Python: Division](https://www.hackerrank.com/challenges/python-division)|Easy|10|[Solution.py](Python/Introduction/Python:%20Division/Solution.py)|
398+
|Introduction|[Loops](https://www.hackerrank.com/challenges/python-loops)|Easy|10|[Solution.py](Python/Introduction/Loops/Solution.py)|
399+
|Introduction|[Write a function](https://www.hackerrank.com/challenges/write-a-function)|Medium|10|[Solution.py](Python/Introduction/Write%20a%20function/Solution.py)|
400+
|Introduction|[Print Function](https://www.hackerrank.com/challenges/python-print)|Easy|20|[Solution.py](Python/Introduction/Print%20Function/Solution.py)|
401+
390402
## Distributed Systems
391403
|Subdomain|Challenge|Difficulty|Score|Solution|
392404
|-|-|-|-|-|

0 commit comments

Comments
 (0)