Computer Science and Maths graduate with 3+ years tutoring experience
Asked by Cucu · 2 years ago
Write a program that displays all prime numbers in the range [a, b], where a and b are two integers read from the keyboard?
In python: def is_prime(x): if x == 1 or x == 0: return False if x == 2: return True for i in range(2,x): if x % i == 0: return False return True a = int(input("First number:")) b = int(input("Second number:")) primes = [] for i in range(a,b+1): if is_prime(i): primes.append(i) print(primes)
Asked by eleanor · 2 years ago
Pierres unicycle wheel has a diameter of 80cm. how far does the unicycle move if he turns the wheel once?
The unicycle will move exactly as far as the circumference of the wheel. To work out the circumference you need to calculate 2πr. In this case the radius, r, is 40 which is half of the diameter 80. 2×π×40 is 251.3274 The units are cm, so 251.33cm or 2.51m (to two decimal places)
Asked by Chloe · 2 years ago
-5< 4x + <_13?
Divide everything by 4: -1.25<X<3.25 So x has to be in that range (-1.25 to 3.25). You can draw this on an X axis on a graph.
Computer Science and Maths graduate with 3+ years tutoring experience