0
Expanansional growth
In an exercise for Phyton, you need to do the operation 0.01 x2 for 30 days. what code do you need I can't figure it out?
4 Respuestas
+ 1
Please correct those typos.
As for the problem, you can simply raise to the power of the day reached until the 30th day
That'd be like
for day in range(30):
x = 0.01 * 2**(day+1)
0
0.01*2 {1st day}
0.01*2*2 {2nd day}
0.01*2*2*2 {3rd}
...
...
0.01*2*2*.......*2
= 0.01*(2**30) on 30th day..
0
*Exponential
*Python
Attention to detail is important in programming.
0
package main
import "fmt"
func main() {
var years int
fmt.Scanln(&years)
s := 7
for i := 0; i < years; i++{
s = s*2
}
fmt.Println(s)
}