""" Purpose: determine the hidden super power of classmate """ # get access to web-based data support import url # set base web folder data location PEOPLE_URL = "http://www.cs.virginia.edu/~cs1112/people/" # header people location, every person has a folder # set file name file_name = "my-power.txt" # specific file of interest # get computing id of interest reply = input( "Enter computing id: " ) # person of interest # clean up the reply to get the user id user_id = reply.strip() # get rid of all that whitespace user_id = user_id.lower() # all uva computing ids are all lowercase # set person folder web_folder = PEOPLE_URL + user_id + "/" # folder is going to be the concatenation of the people url, the computing id, and a slash # set link link = web_folder + file_name # links are going to be folder + file, sometimes you need to take steps to # set up one or the other but the final link will be folder+file name # display link print( "link:", link ) # read web page contents = url.get_contents( link ) # hands back a string containing the contents of a webpage # clean up power = contents.strip() # don't need to make it all lowercase this time since we aren't using it in the link # reveal word print( power )