def create_club(): # your code goes here! name = input("Pick a name for your awesome new club: ") description = input("What is your club about?\n") name = Club(name, description) clubs.append(name) print( "Enter the numbers of the people you would like to recruit to your new club (-1 to stop):" ) print("-----------------------------------") counter = 1 for member in population: print("[%s] %s" % (counter, member.name)) counter += 1 while True: enroll = False try: rec = int(input()) if rec != int(-1) and rec <= len(population): for member in name.members: if population[rec - 1] == member: print("Member already enrolled in club") enroll = True if enroll == False: name.recruit_member(population[rec - 1]) elif rec == int(-1): name.recruit_member(myself) name.assign_president(myself) print("Here's your club: \n%s\n%s\nMembers:" % (name.name, name.description)) name.print_member_list() break except: print("You must input a number within range") options()
def create_club(): # your code goes here! name = input("Pick a name for your new club: \n") des = input("What is your club about? ") newClub = Club(name, des) print() for p in population: print("[" + str(population.index(p)) + "]" + p.name) print() num = input( "Please enter the number of the person you'd like to recruit to your new club or '-1' to stop: \n" ) #print ("----------------------------------------------------------------------------------") while num != "-1": if int(num) < len(population): if population[int(num)] not in newClub.members: newClub.recruit_member(population[int(num)]) num = input() else: print("Member already exists please try again:") num = input() else: print("Invalid number please try again:") num = input() newClub.recruit_member(myself) newClub.assign_president(myself) print("Here's your club: \n") print(newClub) newClub.print_member_list() clubs.append(newClub)
def create_club(): # your code goes here! pick_name = input("pick name for you club: ") pick_discription = input("What is your club about: ") club = Club(pick_name, pick_discription) club.recruit_member(myself) club.assign_president(myself) clubs.append(club) print( "Enter the number of the people you would like to recuit to yout new club (-1 to stop):\n----------------------------------------" ) print("---------------------------------------") for index, person in enumerate(population): print("[%s] %s" % (index + 1, person.name)) while True: member_name = input() if member_name == "-1": break elif int(member_name) >= 1 and int(member_name) <= len(population): club.recruit_member(population[int(member_name) - 1]) print("Member addedd") else: print("invalid input") print("here is your club: %s\n disciption: %s\n" % (club.name, club.description)) club.print_member_list() options()
def create_club(): # your code goes here! print("Pick a name for your awesome new club: ") club_name = input() print("What is your club about?") des = input() new_club = Club(club_name, des) print( "Enter the numbers of the people you would like to recruit (-1 to stop)" ) counter = 1 for i in population: print("[%s] %s \n" % (counter, i.name)) counter += 1 inpt = input() while inpt != '-1': num = int(inpt) new_member = population[(num - 1)].name new_club.recruit_member(new_member) inpt = input() print("Here's your club: \n %s \n %s \n" % (new_club.name, new_club.description))
def create_club(): # your code goes here! print(" Pick a name for your new club: ") user_input_name = input(" ") print("what is your club about? ") user_input_desc = input(" ") new_club = Club(user_input_name, user_input_desc) print( " Enter the number of the people you would like to recruit to your new club (-1 to stop): " ) print("------------------------------------------------------") for item in population: print("%s ,%s " % (population.index(item) + 1, item.name)) user_input_pop = input("") while user_input_pop != "-1": if population[int(user_input_pop) - 1] in population: new_club.recruit_member(population[int(user_input_pop) - 1]) user_input_pop = input("") print("here's your club: ") print(user_input_name) print(user_input_desc) print("Members: ") total_age = 0 for member in new_club.members: print(" - %s (%s Years old) - %s" % (member.name, member.age, member.bio)) print("") total_age += member.age average = float(total_age) / len(new_club.name) print(" Average age in the club: %2f Years" % average) clubs.append(new_club) print("Ok %s Club is successfully Created " % new_club.name) options()
def create_club(): # your code goes here! name_club = input("pick a name for your awesome new club :") print("what is your club about ?") disc_club = input("") new_club = Club(name_club, disc_club) print(" how many Persons you want to add to your club (-1 to stop)") print("....") for item in population: print("(%s) %s" % (population.index(item) + 1, item.name)) member = input("> ") while member != "-1": if population[int(member) - 1] in population: new_club.recruit_member(population[int(member) - 1]) member = input("> ") print("here is your club") print(new_club.name) print(new_club.description) print("members :") total_age = 0 for member in new_club.members: print("member name is: %s \n member age is: %s \n - %s " % (member.name, member.age, member.bio)) print("...") total_age == member.age avrg = float(total_age) / len(new_club.members) print("the average is %.2f years old " % avrg) clubs.append(new_club) print("your %s club is created " % new_club.name) options()
def create_club(): # your code goes here! print("\n-----------------------------------") name = input("Name thy club: ") description = input("what's it all about? ") new_club = Club(name, description) print( "Enter the numbers of the people you would like to recruit to your own club (-1 to stop): " ) print("\n-----------------------------------\n") new_club.recruit_member(myself) new_club.assign_president(myself) key = 1 for member in population: print("[%d] %s" % (key, member.name)) key += 1 while True: user_in = input("> ") if user_in == "-1": break elif user_in.isalpha( ) or int(user_in) > len(population) or int(user_in) < 1: print("Please enter a valid number: ") else: new_club.recruit_member(population[int(user_in) - 1]) print("\n-----------------------------------") print("Here's your club:") print(new_club.name) print(new_club.description) new_club.print_member_list() clubs.append(new_club)
def create_club(): # your code goes here! name = input("Pick a name for your awesome new club: ") description = input("What is your club about? ") new_club = Club(name, description) print( "Enter the numbers of the people you would like to recruit to your new club (-1 to stop):" ) count = 1 for member in population: print("[%s] %s" % (count, member.name)) count += 1 recruit_people = "" #new_members = [] new_club.assign_president(myself) while True: recruit_people = int(input()) if recruit_people == -1: break else: new_club.recruit_member(population[recruit_people - 1]) print("Here's your club: ") print(new_club.name) print(new_club.description) print("Members:") #new_club.assign_president(myself) Total_age = myself.age #for Person in new_club.club_members: new_club.print_member_list()
def create_club(): # your code goes here! thename = input("Pick a name for your good club: ") description = input("What is your club about? ") newclub = Club(thename, description) newclub.assign_president(myself) print( "Enter the numbers respresenting the person that you want to recruit:(-1 to stop) \n --------------------------------------" ) counter = 1 for eachperson in population: print("[" + str(counter) + "] " + eachperson.name) counter += 1 selection = 0 totalage = myself.age while (not selection == '-1') and (selection > -1 and selection < 16): selection = int(input("> ")) if (selection == -1): break newclub.recruit_member(population[selection - 1]) totalage = totalage + population[selection - 1].age avgage = totalage / (len(newclub.members) + 1) print("Here's your club: \n " + thename + "\n" + description) newclub.print_member_list() print( "Average age in this club: %f yr \n ----------------------------------" % avgage)
def create_club(): # your code goes here! userinputx = input("Pick a new name for your awesome new club: ") userinputy = input("What is your club about?\n") clubx = Club(userinputx, userinputy) clubx.recruit_member(myself) clubx.assign_president(myself) counter = 1 for i in population: counter = counter + 1 counterx = 1 print( "Enter the numbers of the people you would like to recruit to your new club (-1 to stop):" ) for i in population: print("[" + str(counterx) + "]" + i.name) counterx = counterx + 1 userinputl = input() while (userinputl != str(-1)): try: if int(userinputl) in range(0, len(population)): if population[int(userinputl) - 1] not in clubx.people: clubx.recruit_member(population[int(userinputl) - 1]) elif population[int(userinputl) - 1] in clubx.people: print(population[int(userinputl) - 1].name + " is already in club") else: print("Invalid input! Please try again:") else: print("Invalid input! Please try again") except ValueError: print("Invalid input! Please try again") userinputl = input() clubs.append(clubx) print("Here's your club:") print("Club Name: " + clubx.name) print("Club Description: " + clubx.description + "\nClub members list:") clubx.print_member_list() print("\n") application()
def create_club(): # your code goes here! club_name = input("Pick a name for your awesome new club: ") club_description = input("What is your club about?\n") club = Club(club_name, club_description) club.recruit_member(myself) club.assign_president(myself) print( "Enter the numbers of the people you would like to recruit to your new club (-1 to stop): " ) print_population() person_to_be_recruited = "" while person_to_be_recruited != "-1": person_to_be_recruited = input("> ") club.recruit_member(population[int(person_to_be_recruited) - 1]) print("Here's your new club...") print(club.name) print(club.description) club.print_member_list() clubs.append(club)
def create_club(): # your code goes here! clubName = input("What would you like to name your club? ") clubDesc = input("What is your club about? ") newClub = Club(clubName, clubDesc) user_input = input( "Enter the numbers of people you would like to recruit (-1 to stop)") for i in population: print(" [%s] %s" % (population.index(i) + 1, i.name)) while True: user_input = input() if int(user_input) > 0 and int(user_input) < 16: user_input = input( "enter # of the next member you want to add ") #number x = population[int(user_input) - 1] newClub.recruit_member(x) elif user_input == "-1": break else: print("please enter a valid #") newClub.recruit_member(myself.name) newClub.assign_president(myself.name) clubs.append(newClub) print("Here is your new club: \n %s \n %s \n members: " % (newClub.name, newClub.description)) newClub.print_member_list() total = 0 count = 0 for i in newClub.members: total += i.age count += 1 average = total / count print("Avg age in this club = %d" % average)
def create_club(): name = input("Pick a name for your awesome new club: ") description = input("What is your club about?\n") new_club = Club(name, description) new_club.recruit_member(myself) new_club.assign_president(myself) print( "Enter the numbers of the people you would like to recruit to your new club (-1 to stop):" ) print_population() num = 0 while num != "-1": num = input("> ") if num.isdigit() and int(num) <= len(population): person = population[int(num) - 1] new_club.recruit_member(person) print("Here's your club:") print(new_club.name) print(new_club.description) new_club.print_member_list() clubs.append(new_club)
def create_club(): # your code goes here! club_exists = False club_added = False while not club_added: """I have to check if the club name already exists to avoid repetition problems""" club_name = input("Pick a name for your club: ") for i in clubs: if club_name.lower().strip() == i.name.lower().strip(): club_exists = True if not club_exists: # only add the club if it doesn't exist club_description = input("What is your club about?\n") club = Club(club_name, club_description) club.assign_president(myself) club.recruit_member(myself) print( "Enter the number of the member you want to add to your club or '-1' to stop" ) for i in range(0, len(population)): print("[%d] %s" % (i + 1, population[i].name)) opt = 0 # Loops through asking the user to add members and checks if they've been already added while opt != -1: try: opt = int(input("Enter the number :")) if 0 < opt <= len(population) and population[ opt - 1] not in club.members_list: club.recruit_member(population[opt - 1]) else: print("Member non-existent or already added") except ValueError: print("Non-numeric value") club.print_club() clubs.append(club) club_added = True else: print("Club name already exists") club_exists = False
def create_club(): # your code goes here! title = input("Give a name to your club, go wild: ") desc = input("What is it gonna be about? ") newClub = Club(title, desc) print( "Enter the numbers of the people you like to recruit to your club (-1 to stop):" ) print("=" * 20) newClub.assign_president(myself) i = 1 for person in population: print("[%s] %s" % (i, person.name)) i += 1 while True: num = input(">> ") try: if int(num) in range(1, 16): if population[int(num) - 1] in newClub.members: print("Member is already added!") else: newClub.recruit_member(population[int(num) - 1]) print("Member added!") elif int(num) == -1: break else: print("value not part of the list, try again :d") continue except ValueError: print("value not part of the list, try again :d") continue clubs.append(newClub) print("Here is your club!!") print("=" * 20) print("Name: %s \nDescription: %s" % (newClub.name, newClub.description)) newClub.print_member_list() total = 0 for x in newClub.members: total += x.age avrg = total * 1.0 / len(newClub.members) print("Avrage age in the club: %syr" % avrg) print("-" * 20)
def create_club(): name = input("What is your club name?\n> ") desc = input("What will it be about?\n> ") club = Club(name, desc) clubs.append(club) print( "Type the number of the person that you would like to add to your club, and type \"-1\" when you are done.\n----------------------------------------------" ) iteration = 1 for person in population: print("[%d] %s" % (iteration, person.name)) iteration += 1 while (True): opt = int(input("> ")) if opt > 0 and opt < iteration: for member in club.members: if member.name == population[opt - 1].name: print("That member is already in your club.") break else: club.recruit_member(population[opt - 1]) elif opt == -1: break else: print("Invalid option, try again.") club.assign_president(myself) club.recruit_member(myself) print( "Here is your club: \nClub name: %s \nClub description: %s \nMembers:" % (club.name, club.description)) club.print_member_list() total_age = 0.0 for member in club.members: total_age += member.age print("Average age in this club is: %.1fyr" % (total_age / len(club.members)))
def create_club(): # your code goes here! club_name = input("Type the name of your club >>>") club_bio = input("Type a description of your club\n>>>") new_club = Club(club_name,club_bio) new_club.recruit_member(myself) new_club.assign_president(myself) print("Enter the numbers of the people you want to recruit to your club or -1 to stop") print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=") for person in population: print("[%d] %s" %(population.index(person)+1, person.name)) print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=") user_input = "" while user_input != "-1": user_input = input(">>>") if user_input.isdigit() and int(user_input) <= 15: new_club.recruit_member(population[int(user_input)-1]) clubs.append(new_club) print("Here is your club details:\n\tName: %s\n\tDescription: %s" %(new_club.name, new_club.description)) print("Members:\n") new_club.print_member_list()
def create_club(): # your code goes here! club_name=str(input("Pick a name for your awesome new club: ")) while (not isValid(club_name)) or isReservedClubName(club_name): if isReservedClubName(club_name): print('"%s" is reserved for another club, please think of another name:'% club_name) club_name=str(input()) club_desc=str(input("What is your club about?\n")) while not isValid(club_desc): club_desc=str(input()) new_club=Club(club_name,club_desc) new_club.assign_president(myself) clubs.append(new_club) print("Enter the numbers of the people you would like to recruite to your new club (-1 to stop):") print("-"*50) for i in range(len(population)): print("[%d] %s" %(i+1, population[i])) club_members=[] while True: club_member=input() if str(club_member)=="": print("No selection!!!") elif not isNumber(club_member): print("Wrong selection!!!") else : club_member=int(club_member) if club_member==-1 : break elif club_member<1 or club_member>len(population): print("Wrong number!!") elif club_member in club_members: print("This member already exist in the club") else: club_members.append(club_member) club_member=population[club_member-1] new_club.recruit_member(club_member) print("Here is your club:") print(new_club.name+"\n"+new_club.description) new_club.print_member_list() average_age(new_club)
def create_club(): # Picking option 1 should prompt the user for a name for their new club and a description of their new club. Example: print("Creating a new club!") club_name = input("What is your clubs name? ") descp = input("What is the club, %s, about? " % club_name) tempClub = Club(club_name, descp) populate_newClub(tempClub) tempClub.members = [myself] + tempClub.members tempClub.assign_president(myself) clubs.append(tempClub) print(" Here is your club overview:") print(" Title: %s" % tempClub.name) print(" Description: %s" % tempClub.description) print(" Members:") tempClub.print_member_list_detail()
def create_club(): # your code goes here! print("Pick a name for your awesome new club:") name = input() print("What is your club about?") desc = input() newClub = Club(name, desc) newClub.assign_president(myself) print( "Enter the number os the people you would like to tawtheef to your new club (-1 to stop):" ) for i in population: print("[", population.index(i) + 1, "] ", i.name) num = input() while int(num) != -1: newClub.recruit_member(population[int(num) - 1]) num = input() clubs.append(newClub) newClub.print_member_list()
def create_club(): # your code goes here! name = input("\nPick a name for your awesome club:\n\n") description = input("\nWhat is your club about? \n\n") new_club = Club(name, description) clubs.append(new_club) new_club.assign_president(myself) print("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*\n") print( "Enter the numbers of people you would like to recruit to your new club: \n " ) i = 0 for member in population: i = i + 1 print("[" + str(i) + "] " + member.name) print("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*\n") user_pick_num = input() while (user_pick_num != str(-1)): mem_location = population[int(user_pick_num) - 1] new_club.recruit_member(mem_location) user_pick_num = input() else: print("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*\n") print("Here's your club: \n") print(new_club.name) print() print(new_club.description) print() print("members: \n") print() new_club.print_member_list()
def create_club(): print() club_name = input("Type your club name: ") print() club_description = input("Type a brief description of your club: ") print() new_club = Club(club_name, club_description) clubs.append(new_club) print( "Enter the numbers of the people you would ()like to recruit to your new club (enter -1 to stop): " ) print( "-----------------------------------------------------------------------------------------------" ) count = 1 for member in population: print("[%s] %s" % (count, member.name)) count += 1 print() picked_member = input("") while picked_member != "-1": new_club.recruit_member(population[int(picked_member) - 1]) picked_member = input("") new_club.assign_president(my_name) print() print("Here are your club details: ") print(new_club.name) print(new_club.description) print("Members:") print() age_sum = 0 for member in new_club.members: print("- %s ( %s years old ) %s" % (member.name, member.age, member.bio)) print() age_sum += member.age average_age = round((age_sum / len(new_club.members)), 1) print("The average age of members in this club is: %s" % average_age) print( "-----------------------------------------------------------------------------------------------" )
def create_club(): club_name = input("pick a name for your awesome new club") club_dis = input("what is your club about?") new_club = Club(club_name, club_dis) new_club.recruit_member(myself) new_club.assign_president(myself) clubs.append(new_club) new_club.assign_president(myself) print( "enter the numbers of the people you would like to recruit to your club(-1 to stop)" ) for index, person in enumerate(population): print("[%s ] %s" % (index + 1, person.name)) while True: member = input() if member == '-1': break elif int(member) >= 1 and int(member) <= len(population): new_club.recruit_member(population[int(member) - 1]) print("member has been added") else: print("invalid") text = (""" here is your club : %s %s Members : """ % (new_club.name, new_club.description)) print(text) new_club.print_member_list()
def create_club(): club_name = input("Choose your club name: ") club_description = input("What is the club about? ") new_club = Club(club_name, club_description) new_club.assign_president(myself) print( "Enter the number of members you would like to recruit in your club or enter -1 to stop." ) i = 1 #print the names list for person in population: print("[%s] %s" % (i, person.name)) i += 1 #user chooses the names member_choice = input() while int(member_choice) != -1: if int(member_choice) in range(1, 16): new_club.recruit_member(myself) new_club.recruit_member(population[int(member_choice) - 1]) else: print("Invalid member, please try again.") member_choice = input() print("------------------------------------------------------") print("\tClub name: %s\n\tClub description: %s\n\tClub President: %s" % (new_club.name, club_description, my_name)) print("\tClub Members:") new_club.print_member_list() avg_age = new_club.average_age() print("\tThe average age in this club is %s years old." % avg_age) clubs.append(new_club)
audrey = Person("Audrey", "just some woman", 31) asis = Person("Asis", "a joke we have at Coded", 1) caesar = Person("Julius Caesar", "Google me.", 56) marcus_aurelius = Person("Marcus Aurelius", "Roman Emperor, philosopher. 'Nuff said.", 61) people = [ steve, michelle, john, ron, maha, fatma, dude, dudette, forever_alone, confession_bear, jack, audrey, asis, caesar, marcus_aurelius ] population = [] for person in people: population.append(person) book = Club("The KPOP Dome", "Your average secret kpopies") book.recruit_member(steve) book.recruit_member(ron) book.recruit_member(maha) book.recruit_member(confession_bear) book.recruit_member(audrey) book.assign_president(ron) sports = Club("Anime Weebs", "Anime for LIFE!") sports.recruit_member(michelle) sports.recruit_member(john) sports.recruit_member(jack) sports.recruit_member(caesar) sports.recruit_member(marcus_aurelius) sports.assign_president(jack)
audrey = Person("Audrey", "just some woman", 31) asis = Person("Asis", "a joke we have at Coded", 1) caesar = Person("Julius Caesar", "Google me.", 56) marcus_aurelius = Person("Marcus Aurelius", "Roman Emperor, philosopher. 'Nuff said.", 61) people = [ steve, michelle, john, ron, maha, fatma, dude, dudette, forever_alone, confession_bear, jack, audrey, asis, caesar, marcus_aurelius ] population = [] for person in people: population.append(person) book = Club("Book Club", "A book club") book.assign_president(ron) book.recruit_member(ron) book.recruit_member(steve) book.recruit_member(maha) book.recruit_member(confession_bear) book.recruit_member(audrey) sports = Club("Sports Club", "A sports club") sports.recruit_member(jack) sports.assign_president(jack) sports.recruit_member(michelle) sports.recruit_member(john) sports.recruit_member(caesar) sports.recruit_member(marcus_aurelius)
def create_club(): # your code goes here! club_name = input("Pick a name for your awesome new club: \n") about = input("What is your club about? \n") club1 = Club(club_name, about) club1.recruit_member(myself) club1.assign_president(myself) clubs.append(club1) print( "Enter number of the people you would like to recruit to your new club.(-1 to stop):\n" ) #while int(m_choice) != -1: index = 0 for p in population: print("[%s] %s" % (index + 1, p.name)) index += 1 m_choice = int(input()) while m_choice != -1: m_choice = int(input()) if m_choice == 1: m1 = population[0] club1.recruit_member(m1) elif m_choice == 2: m1 = population[1] club1.recruit_member(m1) elif m_choice == 3: m1 = population[2] club1.recruit_member(m1) elif m_choice == 4: m1 = population[3] club1.recruit_member(m1) elif m_choice == 5: m1 = population[4] club1.recruit_member(m1) elif m_choice == 6: m1 = population[5] club1.recruit_member(m1) elif m_choice == 7: m1 = population[6] club1.recruit_member(m1) elif m_choice == 8: m1 = population[7] club1.recruit_member(m1) elif m_choice == 9: m1 = population[8] club1.recruit_member(m1) elif m_choice == 10: m1 = population[9] club1.recruit_member(m1) elif m_choice == 11: m1 = population[10] club1.recruit_member(m1) elif m_choice == 12: m1 = population[11] club1.recruit_member(m1) elif m_choice == 13: m1 = population[12] club1.recruit_member(m1) elif m_choice == 14: m1 = population[13] club1.recruit_member(m1) elif m_choice == 15: m1 = population[14] club1.recruit_member(m1) print("Here's your club:\n%s\n%s" % (club_name, about)) club1.print_member_list()