Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*** NEEDED IN PYTHON *** We call a number an up number if the digits of the number increase (or stay the same) as we

*** NEEDED IN PYTHON ***

We call a number an up number if the digits of the number increase (or stay the same) as we read the number. To illustrate:

123 is an up number 2577 is an up number 598 is not an up number

Similarly, in a down number the digits of the number decrease (or stay the same). To illustrate

321 is a down number 775 is a down number 123 is not a down number.

Finally combining the two we define an updown number. In an updown number the digits initially increase (or stay the same) and then they decrease (or stay the same). Once they have started to decrease they can not increase again.

To illustrate: 123431 is an updown number 4577852 is an updown number 123758 is not an updown number (because it the digits increased and then decreased but then increased again) 4789089 is not an updown number. We consider a number nice if its either an up, a down or an updown number.

Write a function which given a number determines if it is a nice number. Your function should take in a number and return yes if it is an up, a down or an updown number. Your function should return no otherwise. That is to say if the number is nice it should return yes and no otherwise.

*** Does anyone have a working code for this? I need it to use as a guideline to study for an exam. ***

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions