Expanansional growth | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

17th Feb 2022, 7:19 PM
Robin hamerslag
4 Answers
+ 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)
18th Feb 2022, 12:22 AM
Amd TheWise
Amd TheWise - avatar
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..
17th Feb 2022, 7:28 PM
Jayakrishna 🇮🇳
0
*Exponential *Python Attention to detail is important in programming.
17th Feb 2022, 10:53 PM
Simon Sauter
Simon Sauter - avatar
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) }
20th Dec 2022, 2:21 AM
Lavanya Mangala