• You want to use the global keyword inside your functions in order to allow your variable to be modified outside the defining scope.

    Actually you think you want globals,but usually they lead to grief, since it can be hard to debug -- for instance when you forget to declare global inside a function, you can read variables defined in external scope but not modify it. So it is easy to get confused.

    Consider using a class, then you can store things like that as class instance variables. Then it is never ambiguous which copy of the variable you are modifying.

  • import ui import time from random import choice class myclass(): def __init__(self): #self.v = ui.load_view('UIwithOtherName.pyui') self.v = ui.load_view() self.v.present('sheet') self.v.name = 'goapp' self.intro() self.key() def intro(self): self.v['textfield1'].text = "The Guitar Oracle is listening." time.sleep(2) def key(self): self.v['textfield1'].text = "Good bye." myclass()
  • It would be cleaner if those functions returned the answer, or raise an exception, e.g:

    selected_key=key() selected_tone=tone() selected_level=level()

    level() probably should not be an embedded function, but should live at the same level as key() and tone()

  • word = 'python' print('*'.join(word))
Internal error.

Oops! Looks like something went wrong!