Answers for "goto in python"

1

goto in python

pip install goto-statement

# https://github.com/snoack/python-goto

from goto import with_goto

@with_goto
def range(start, stop):
    i = start
    result = []

    label .begin
    if i == stop:
        goto .end

    result.append(i)
    i += 1
    goto .begin

    label .end
    return result
Posted by: Guest on August-06-2021
1

count_values in python

idx.value_counts()
Posted by: Guest on May-07-2020
0

go to line in python

def goto(linenum):
    global line
    line = linenum

line = 1
while True:
    if line == 1:
        response = raw_input("yes or no? ")
        if response == "yes":
            goto(2)
        elif response == "no":
            goto(3)
        else:
            goto(100)
    elif line == 2:
        print "Thank you for the yes!"
        goto(20)
    elif line == 3:
        print "Thank you for the no!"
        goto(20)
    elif line == 20:
        break
    elif line == 100:
        print "You're annoying me - answer the question!"
        goto(1)
Posted by: Guest on December-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language