Python
# Question 1:
# Create a list using List Comprehension.
# assign it to a variable.
# this list should have a random length:
# -> using range() in your List Comprehension
# -> random.randInt() to get a random number between 5 and 100
# the random number you get form randInt should be the input
# into your range()
# random length means that everytime the code is executed, a new
# length is determined.
# Resources:
# -> https://docs.python.org/3/library/random.html
# -> https://www.geeksforgeeks.org/python-list-comprehe…
# Question 2:
# Using a For loop, iterate through each item in the list you created
# above, and print out the following string….
# “The value
# at the end of the for loop, you should print the following line:
# “List Iteration Completed.”
# Question 3:
# Given the following variable
string_example = “abcdefghijklmnop”
# create a list in which each element is a single character from the
# string above. Use List comprehension, and remember that string_example
# is just another sequence. Assign this list to a variable.
# Question 4:
# Using a for loop, iterate through each item in the list you created
# in question 3 and print out the following string…
# “Capitalized character at position
# remember that each item in the list is a string, and the String
# object has a method that allows you to get the Uppercase version
# of a string.
# Question 5:
# Using the list created in Question 3 create a dictionary for which
# the keys are the indexes of the list and the values are the elements
# of the list. There are many ways to create a dictionary.
Question 6:
# Given the following variables
my_list = [“answer”, “hotel”, “road trip”, “kitchen”, “tree”, “hotel”]
test_word = “”
# write conditional logic(if statements) as follows:
# If the test_word is in my_list -> print “The test word is in the list”
# If the test_word is in my_list and it appears in the list more than once ->
# in addition to the first print statement, you should also print:
# “The test word appears
# If the test_word is not in my_list print: “The test word is no where to be found”
# to test your logic, run your code multiple times with different values for test_word
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount