**IN PYTHON**
Given a range from 10-50, write a code in python that shows how many odd and even numbers there are, and list them out.
#Python program that finds the number of even number
count
#and number of odd number count and print the results to
python console
#main.py
def main():
print('Finding number of even and number of odd
values')
#set counters to 0
evenCount=0
oddCount=0
#create two empty lists
evenList=[]
oddList=[]
#loop over range of 10 to
50
for number in range(10,50):
#check if number
is even
if number %2==0:
evenList.append(number) #insert number to even list
#increment evenCount by 1
evenCount=evenCount+1
else:
oddList.append(number) #insert number to odd list
# increment oddCount by 1
oddCount=oddCount+1
print('Finding count of even and odd count in a
range of 10 to 50')
print('Even number list : ',evenList)
print('Odd number list : ', oddList)
print('Number of even number count:
',evenCount)
print('Number of odd number count: ',
oddCount)
#calling main method
if __name__ == '__main__':
main()
-----------------------------------------------------------------------------------------------------------------------
Sample Output:
Finding number of even and number of odd values
Finding count of even and odd count in a range of 10 to 50
Even number list : [10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
34, 36, 38, 40, 42, 44, 46, 48]
Odd number list : [11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33,
35, 37, 39, 41, 43, 45, 47, 49]
Number of even number count: 20
Number of odd number count: 20
**IN PYTHON** Given a range from 10-50, write a code in python that shows how many...
IN PYTHON
write a program that asks the user to enter 10 numbers and store them in the list and then find the followings: • Maximum • Minimum prime numbers in the list • even numbers in the list • odd numbers in the list.
Can you help me write a Python 3.7 code for this question? Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user: The list of integers The lowest number in the list The highest number in the list The total sum of all the numbers in the list The...
Python: Given a list named listOfThings, write a function that prints out if there are an odd number of things in the list or an even number of things in the list. If there is an even number of things, your function should print There is an even number of items in the list. If there is an odd number of things, your function should print There is an odd number of items in the list. Use the following function...
1. Write a Python function to count how many python function definitions in a given Python program. 2. Write a Python function to return the number of word wrapped lines of given number of characters in a given text file. Inside your function you must do it in a single line of code except docstring and comments.
: Given a specific number, consider all the numbers from 1 to given number and calculate how many of them are odd, even and multiples of 3. For instance: number = 9 then consider {1, 2, 3, 4, 5, 6, 7, 8, 9} count of even numbers = 4 // 2, 4, 6, 8 count of odd numbers = 5 // 1, 3, 5, 7, 9 count of multiples 3 = 3 // 3, 6, 9 note. You do not...
Python Code Write a program using functions and mainline logic which prompts the user to enter a number. The number must be at least 5 and at most 20. (In other words, between 5 and 20, inclusive.) The program then generates that number of random integers and stores them in a list. The random integers should range from 0 to 100. (You can use a wider range if you want, but the lower end of the range must be at...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Write Python code examples of statements to remove the name at position 2 from the list in problem 32, and to remove one of the remaining names by referencing that name. Write Python code to declare a tuple named stuck that holds the three remaining names from famfri by referencing those names as elemens of famfri. Declare a Python set containing the names of the four seasons. What happens if you declare a set using a list that contains two...