This is an old revision of the document!


02. Let's do the math!

Python is also popular for its numeric manipulation features (it can handle very large numbers!). 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!);
  • 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 :( )!
ii/labs/s2/01/tasks/02.1679162506.txt.gz · Last modified: 2023/03/18 20:01 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0