Question: for python 2. Write code to repeatedly ask the user for a number. If the number is positive and even, print out a happy message.

for python

2. Write code to repeatedly ask the user for a number. If the number is positive and even, print out a happy message. If the number is positive and odd, print out a sad message. If the number is negative, print out an angry message If they enter zero, stop asking If they enter something that isn't an integer, print out a message telling them they are an idiot, but keep looping 3. **HARD QUESTION** Given a list of random numbers, separate them into prime and composite (non-prime) numbers. Reminder: A prime number can only be divided evenly by 1 and itself. You'll need two nested for loops to do this. 4. Ask the user for a positive integer. Then, repeatedly do the following: If the number is even, divide it by 2 If the number is odd, multiply it by 3 and add 1 If you reach the number 1, stop Keep track of the number of steps it took to reach 1, and print them out once the loop is over.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!