I'm still learning how to work within classes. I'm trying to get user input from the user using self methods (Training exercises).
Here is my code (I just want to get the user input and display it, but with using methods)
import os
import time
class Programs:
def basicintro(self):
print "Welcome to the BMR Calculator"
time.sleep(1)
def createname(self,name):
self.name = name
def ask(self):
while name == "":
name = raw_input("Name:")
if name != "":
print "Hello", name
time.sleep(1)
else:
print name
def main():
object1 = Programs()
object1.basicintro()
object1.createname()
object1.ask()
raw_input("\n\nPress enter to exit.")
main()
I basically just want to ask the user to input their name and then make their name an object so if i need it later in the program, I can just call it