qaisahmad commited on
Commit
603ba9b
·
verified ·
1 Parent(s): b9afa38

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Fungsi untuk menghitung skala Fibonacci
4
+ def fibonacci_scale(number):
5
+ fibonacci_ratios = [0.236, 0.382, 0.5, 0.618, 1.0]
6
+
7
+ # Menghitung 5 angka teratas
8
+ top_values = [number + (number * ratio) for ratio in fibonacci_ratios]
9
+
10
+ # Menghitung 5 angka terbawah
11
+ bottom_values = [number - (number * ratio) for ratio in fibonacci_ratios]
12
+
13
+ return top_values, bottom_values
14
+
15
+ # Streamlit input
16
+ st.title("Fibonacci Scale Calculator")
17
+ number = st.number_input("Enter an integer:", min_value=1, step=1)
18
+
19
+ if number:
20
+ top_values, bottom_values = fibonacci_scale(number)
21
+
22
+ st.subheader("Fibonacci Scale - Top 5")
23
+ for i, value in enumerate(top_values, 1):
24
+ st.write(f"Top {i}: {value:.2f}")
25
+
26
+ st.subheader("Fibonacci Scale - Bottom 5")
27
+ for i, value in enumerate(bottom_values, 1):
28
+ st.write(f"Bottom {i}: {value:.2f}")