Repeating equations
 Repeating equations Tbot100 Unladen Swallow Posts: 1 Threads: 1 Joined: May 2019 Reputation: May-28-2019, 11:24 PM (This post was last modified: May-28-2019, 11:34 PM by Tbot100.) Hello, I am fairly new and have not seen anything in which can help me. I am trying to use this code: ```s = float(input("Enter starting value from 0 to 1:")) r = float(input("Enter rate:")) x = s*r*(1-s) print x```And get a result which is correct, but I would like to repeat the formula (s*r*(1-s)) 100 times by making the output, x, s. The output should look something like what is below if s is 0.5 and r is 3: ```0.75 0.5625 0.73828125```and so on and so forth for another 97 times. If you need me to clarify anything or have a suggestion, I would greatly appreciate it. Thanks! Reply Posts: 2,164 Threads: 35 Joined: Sep 2016 Reputation: May-28-2019, 11:33 PM (This post was last modified: May-28-2019, 11:50 PM by Yoriz.) Huh? Ok Use a for loop with a range of 100put the equation inside the loop and then the following also in the loop print x assign s to the value of x Reply heiner55 Verb Conjugator Posts: 606 Threads: 3 Joined: Nov 2016 Reputation: May-29-2019, 02:38 AM (This post was last modified: May-29-2019, 02:38 AM by heiner55.) ```#!/usr/bin/python3 s = float(input("Enter starting value from 0 to 1:")) r = float(input("Enter rate:")) for i in range(1000000): s = s*r*(1-s) print(s)``` Reply

 Possibly Related Threads… Thread Author Replies Views Last Post Why is 2/3 not just .666 repeating? DocFro 4 780 Dec-12-2023, 09:09 AM Last Post: buran repeating a user_input astral_travel 17 2,411 Oct-26-2022, 04:15 PM Last Post: astral_travel if else repeating Frankduc 12 2,645 Jul-14-2022, 12:40 PM Last Post: Frankduc factorial, repeating Aldiyar 4 2,860 Sep-01-2020, 05:22 PM Last Post: DPaul repeating for loop Kaldesyvon 5 3,897 Dec-06-2018, 08:00 PM Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020