Question

Write a Python program using that takes a number as input and then
prints if the number is even or odd. The program should use a
function isEven that takes a number as a parameter and returns a
logical value true if the number is even, false otherwise.

Answer #1

**Python code:**

#defining isEven function

def isEven(n):

#returning True if number is even else
False

return n%2==0

#accepting the number

n=int(input("Enter a number: "))

#calling isEven function and checking if it is Even or not

if(isEven(n)):

#printing Even number

print("Even number")

else:

#printing Odd number

print("Odd number")

**Screenshot:**

**Input and Output:**

Write a function that takes as input an English sentence (a
string) and prints the total
number of vowels and the total number of consonants in the
sentence. The function returns
nothing. Note that the sentence could have special characters
such as dots, dashes,
and so on.
write a python program please.

In C++ Using recursion write a program that takes a positive
integer number and returns whether there is 6. For example, if the
input number is 7068, the function returns true

PYTHON 3
Write a program that prints the count of all prime numbers
between A and B (inclusive), where A and B are defined as
follows:
A = 21212
B = A + 5000
Just a recap on prime numbers: A prime number is any number,
greater or equal to 2, that is divisible ONLY by 1 and itself. Here
are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and
29.
Rules:
You should first...

Python: Write a function that takes in a number as a parameter
and calculates the square of the number up to and including the
value of the parameter. Please use a while or for loop.

Write a PYTHON program that takes the radius of a sphere (a
floating-point number) as input and then outputs the sphere’s
surface area.
The Surface Area of a Sphere is
Surface Area = 4πr²
Surface Area = 4 * PI * radius * radius

How to code this in python
Write a program that computes and prints the first 1000 prime
numbers - simply write out each prime number on a new line. In
implementing this solution I want you to define 2 functions:
is_prime which can be used to test whether a number is a prime
(e.g. is_prime(17) returns True but is_prime(9) returns False) and
compute_primes which will return an array (or Python list) of the
first n primes where n is passed...

Write a Python program to calculate the area of a circle. The
user needs to input the value of the radius of the circle.
area = 3.14 x radius x radius
You should use a function named circlearea to perform the
calculation
3.
Write a Python program to calculate the area of a square. The
user needs to input the value of the length of the square.
area = len*len
You should use a function named squarearea to perform the...

Python: Write a recursive function that takes in a number as a
parameter and calculates the square of the number up to and
including the value of the parameter.

using Python:
Write a function named safe input(prompt,type) that works like
the Python input function, except that it only accepts the
specified type of input. The function takes two arguments:
r prompt: str
r type: int, float, str
The function will keep prompting for input until correct input of
the specified type is entered.
The function returns the input. If the input was specified to be a
number ( float or int), the value returned will be of the correct...

PYTHON: Write a function that takes in a number as a parameter
and calculates the square of the number up to and including the
value of the parameter. The function must perform the process
recursively.

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 9 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 3 hours ago

asked 3 hours ago

asked 3 hours ago

asked 3 hours ago