This shows you the differences between two versions of the page.
ii:labs:s2:01:tasks:02 [2023/03/18 19:38] florin.stancu created |
ii:labs:s2:01:tasks:02 [2024/03/15 13:30] (current) florin.stancu [02. [20p] Let's do the math!] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 02. Let's do some math! ==== | + | ==== 02. [25p] Let's do the math! ==== |
Python is also popular for its numeric manipulation features (it can handle very large numbers!). | Python is also popular for its numeric manipulation features (it can handle very large numbers!). | ||
- | Let's find out! | + | Let's find out: |
* Read a number from the console (you should know how to do it by now; don't forget to convert it to an ''int''!); | * Read a number from the console (you should know how to do it by now; don't forget to convert it to an ''int''!); | ||
* Reverse the number's digits and print the result (e.g., ''13568 => 86531'')! | * Reverse the number's digits and print the result (e.g., ''13568 => 86531'')! | ||
* Define a new function, ''generate_prime(k)'', which takes in an argument and will generate a prime number of exactly ''k'' digits; use it to generate a 15-digit prime number (decrease this if it's taking too long '':('' )! | * Define a new function, ''generate_prime(k)'', which takes in an argument and will generate a prime number of exactly ''k'' digits; use it to generate a 15-digit prime number (decrease this if it's taking too long '':('' )! | ||
- | |||
- | |||