There are given 2 integers a, b and we want to represent the following expressions in Fortran 95 a) a is less than b and both are less than 9. b) Neither a nor b are positive c) a is exactly divided by 4 but it is not exactly divided by 8 code example
Example: Write a function that takes an integer n and returns a random integer with exactly n digits. For instance, if n is 3, then 125 and 593 would be valid return values, but 093 would not because that is really 93, which is a two-digit number.
Import random def rndnum(n): Num = ‘’ for i in range(n): Num = (Num + str(random.randrange(1,9))) if i == 0 else (Num + str(random.randrange(0,9))) return int(‘’.join(Num))