Program to top-up phone with conditions in Python
You can divide your whole program into parts, this way it becomes easy while debugging and increases modularity in the code.
You can divide into multiple functions like

Selecting service.
Add top-up
Restart logic

Refractored code
AVAILABLE_SERVICES = {&quot;Green&quot;, &quot;Blue&quot;, &quot;Red&quot;} 
AVAILABLE_TOPUPS = {50, 100, 300, 500, 1000}


def select_service():
    while True:
        service = input(&quot;Please enter Green, Blue or Red: &quot;).title()
        if service in AVAILABLE_SERVICES:
            print(&quot;Welcome to Top-up Service&quot;)
            break
    return service


def top_up(service):
    times_topup = int(input(&quot;How many times do you want to top up? &quot;))
    topups_selected = []
    for _ in range(times_topup):
        while True:
            topup = int(input(&quot;Please enter 50,100,300,500 or 1000: &quot;))
            if topup in AVAILABLE_TOPUPS:
                topups_selected.append(topup)
                break
            else:
                print(&quot;Try Again!, Wrong Top-up&quot;)

    print(&quot;Top up(s) information : &quot;, topups_selected)
    print(&quot;Total top up(s): &quot;, sum(topups_selected))


def process():
    restart = &quot;Y&quot;
    while restart == &quot;Y&quot;:
        service = select_service()
        top_up(service)
        restart = input(&quot;Do you want to start again?,Y or else: &quot;).upper()
    print(&quot;Thank you for using our service&quot;)


if __name__ == &quot;__main__&quot;:
    process()

Output:
Please enter Green, Blue or Red: Blue
Welcome to Top-up Service
How many times do you want to top up? 2
Please enter 50,100,300,500 or 1000: 7
Try Again!, Wrong Top-up
Please enter 50,100,300,500 or 1000: 50
Please enter 50,100,300,500 or 1000: 10
Try Again!, Wrong Top-up
Please enter 50,100,300,500 or 1000: 100
Top up(s) information :  [50, 100]
Total top up(s):  150
Do you want to start again?,Y or else: Y
Please enter Green, Blue or Red: Red
...
...
...
Do you want to start again?,Y or else: n
Thank you for using our service

Code Review

PEP-8 violations:

E231 - missing whitespace after ,

range(1,n+1) ⟶ range(1, n+1)
{50,100,300,500,1000} ⟶ {50, 100, 300, 500, 1000}




Declare constants for services and top-ups instead of writing {&quot;Blue&quot;, ...} and {50, ...} everywhere.

{&quot;Blue&quot;, ...} ⟶ AVAILABLE_SERVICES = {&quot;Green&quot;, &quot;Blue&quot;, &quot;Red&quot;} Now you can use AVAILABLE_SERVICES instead of writing {&quot;Blue&quot;, ...}
{50, ...} ⟶ AVAILABLE_TOPUPS = {50, 100, 300, 500, 1000}


Use str.title when taking input for service, so &quot;BLUE&quot; would become &quot;Blue&quot;.
Use _ here for i in range(1, n+1) when you are not using i in the loop.

for i in range(1, n+1) ⟶ for _ in range(n)
What's the purpose of _ in python


You can make AVAILABLE_SERVICES as frozenset to make immutable.

AVAILABLE_SERVICES = frozenset({&quot;Green&quot;, &quot;Blue&quot;, &quot;Red&quot;})
AVAILABLE_TOPUPS = frozenset({50, 100, 300, 500, 1000})




You can use pep8online* to check if your code is in accordance with PEP-8 standard.
You can use black* (code formatting tool)
black --line-length 79 your_file.py


* I'm not affiliated to pep8online and black.