What would you change in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What would you change in this code?

Feel free to give me some advice and tell me what you would change here to make it perfect. CODE: https://code.sololearn.com/cSQUT7x6aks7/#py

1st Jun 2017, 9:38 PM
Noname Nonamer
Noname Nonamer - avatar
3 Answers
+ 11
Of course :) We are all here to learn and help each other.
1st Jun 2017, 10:24 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 9
Interesting approach. To be honest, I'd check out the numbers before adding them, though. Saves time and memory. So: for i in range(dice): x = random.randint(100000, 1000000) if str(x) == str(x)[::-1]: total.append(x) print(total)
1st Jun 2017, 9:53 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 2
@Kuba SiekierzyƄski Wow this would make my code much smaller ^^ is it okey if i use it ?
1st Jun 2017, 10:19 PM
Noname Nonamer
Noname Nonamer - avatar