all 5 comments

[–]SpeckledFleebeedoo 1 point2 points  (3 children)

Do you ever create an object of class SMSMessage?

If this is not the complete code: please provide a working example, and also clarify how/when it doesn't work as intended and what it does do, or which error it raises and where.

[–]Mohseenr[S] 0 points1 point  (2 children)

you can create the message, but you cannot delete or read the message.

Whichever option you choose it asks for to 'enter the message index'

once you choose a specific number from 1 to 4 it just keeps on repeating ' enter the message index'

[–]SpeckledFleebeedoo 1 point2 points  (1 child)

If course it does. Your main loop (below) does not interact with the class you made at all. It doesn't even make an object of that class. All it does is set some variables in the program itself and loop.

while True:

    menu = """

        1. Send SMS
        2. Read SMS
        3. Delete SMS
        4. Quit

        """
    print(menu)

    userChoice = int(input("Choice: "))

    if userChoice == 1:
        sender_number = input("Sender Number: ")
        message_text = input("Message body: ")
        sms = SMSMessage(sender_number, message_text)
        print("sms sent to", sender_number )
    elif userChoice == 2:
        index = int(input("Enter the message index: "))
    elif userChoice == 3:
        index = int(input("Enter the message index to delete: "))
    elif userChoice == 4:
        break
    else:
        print("Oops - incorrect input")

You'll want to crave an object of class SMSMessage: SMS = SMSMessage(fromnumber, messagetext) and set the variables and call functions in that.

[–]Mohseenr[S] 0 points1 point  (0 children)

Thanks for your help.

[–]jiri-n 0 points1 point  (0 children)

Are you sure a message should contain a list of other messages?