-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54042f0
commit 2157880
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# harmonic mean between 2 numbers | ||
|
||
def mean(x, y) -> (x + y) / 2 | ||
|
||
def harmonic_mean(x, y) -> 1 / mean(1/x, 1/y) | ||
|
||
print("Harmonic mean between two numbers") | ||
var x_ = input_int("Enter first number: ") | ||
var y_ = input_int("Enter second number: ") | ||
|
||
print(harmonic_mean(x_, y_)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# calculate the volume of a pyramid | ||
|
||
def vol_pyramid(side, height) | ||
var area = side ^ 2 | ||
return (1/3) * area * height | ||
end | ||
|
||
var side_ = input_int("Enter the side of the pyramid: ") | ||
var height_ = input_int("Enter the height of the pyramid: ") | ||
|
||
print(vol_pyramid(side_, height_)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# reverse a string | ||
|
||
var string = input("Enter a string to reverse: ") | ||
var new_string = '' | ||
|
||
for letter in list(string) then | ||
var new_string = letter + new_string | ||
end | ||
|
||
print(new_string) |