If the input is negative, make numItemsPointer be null. Otherwise, make numItemsPointer point to numItems and multiply the value to which numItemsPointer points by 10. Ex: If the user enters 99, the output should be: Items: 990

Respuesta :

Answer:

# the user is prompted for input

user_input = int(input("Enter your number: "))

# if the user_input is negative

# it assigns None to numItemsPointer

# and display None

if(user_input < 0):

   numItemsPointer = None

   print(numItemsPointer)

# if the user_input is positive

# it assigns to numItemsPointer

# the product of the user_input and 10

else:

   numItemsPointer = user_input * 10

   print(numItemsPointer)

Explanation:

The program is written in Python and it is well commented. The python equivalent of null is None. A sample image output is attached.

Ver imagen ibnahmadbello

Otras preguntas

ACCESS MORE
EDU ACCESS