File size: 1,056 Bytes
603ba9b
05036f0
 
 
 
 
 
 
 
603ba9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
import time
import threading

def keep_alive():
    while True:
        time.sleep(600)  # 10 menit

threading.Thread(target=keep_alive, daemon=True).start()

# Fungsi untuk menghitung skala Fibonacci
def fibonacci_scale(number):
    fibonacci_ratios = [0.236, 0.382, 0.5, 0.618, 1.0]
    
    # Menghitung 5 angka teratas
    top_values = [number + (number * ratio) for ratio in fibonacci_ratios]
    
    # Menghitung 5 angka terbawah
    bottom_values = [number - (number * ratio) for ratio in fibonacci_ratios]
    
    return top_values, bottom_values

# Streamlit input
st.title("Fibonacci Scale Calculator")
number = st.number_input("Enter an integer:", min_value=1, step=1)

if number:
    top_values, bottom_values = fibonacci_scale(number)
    
    st.subheader("Fibonacci Scale - Top 5")
    for i, value in enumerate(top_values, 1):
        st.write(f"Top {i}: {value:.2f}")
    
    st.subheader("Fibonacci Scale - Bottom 5")
    for i, value in enumerate(bottom_values, 1):
        st.write(f"Bottom {i}: {value:.2f}")