This is the questions and answers for the first parts Questions: Using Python Create a list with building names 'Richard Weeks Hall’, ’Busch Student Center’, ‘Environmental & Natural Resource Sciences Building’ Replace the list to 'Richard Weeks’, ’Busch Student Center’, ‘Environmental & Natural Resource Sciences Bldg’ Code for the total points of each name by setting• The base points as the length of the building name.• The bonus points: as ‘Bldg’ being equal to 10 points Meaning, 'Academic Building' which would be 'Academic Bldg' would have a base point of 13 and a bonus point of 10 for a total of 23. #1 Create a list of buildings Buildings=[ 'Richard Weeks Hall', 'Busch Student Center', 'Environmental & Natural Resource Sciences Building' ] print("The Building names in the list are: ") print(Buildings) #2 Process the name of each building res = [sub.replace(' Hall', '').replace('Building', 'Bldg') for sub in Buildings] print("The names have been replaced to : ") print(res) #3 Assign Point Value for name in res: if 'Bldg' not in name: print('The total points of ',name, 'is', len(name))else: tot=len(name)+10print('The total points of ',name, 'is', tot) Part 4 Create a for-loop that calculates the value of the building names of the list. If the building values exceed 21, make the variable jack=True. Otherwise, let jack=False.
This is the questions and answers for the first parts
Questions:
Using Python
- Create a list with building names
'Richard Weeks Hall’, ’Busch Student Center’, ‘Environmental & Natural Resource Sciences Building’
- Replace the list to
'Richard Weeks’, ’Busch Student Center’, ‘Environmental & Natural Resource Sciences Bldg’
- Code for the total points of each name by setting
• The base points as the length of the building name.
• The bonus points: as ‘Bldg’ being equal to 10 points- Meaning, 'Academic Building' which would be 'Academic Bldg' would have a base point of 13 and a bonus point of 10 for a total of 23.
#1 Create a list of buildings
Buildings=[ 'Richard Weeks Hall', 'Busch Student Center', 'Environmental & Natural Resource Sciences Building' ]
print("The Building names in the list are: ")
print(Buildings)
#2 Process the name of each building
res = [sub.replace(' Hall', '').replace('Building', 'Bldg') for sub in Buildings]
print("The names have been replaced to : ")
print(res)
#3 Assign Point Value
for name in res:
if 'Bldg' not in name:
print('The total points of ',name, 'is', len(name))
else:
tot=len(name)+10
print('The total points of ',name, 'is', tot)
Part 4
- Create a for-loop that calculates the value of the building names of the list. If the building values exceed 21, make the variable jack=True. Otherwise, let jack=False.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images