# [ ] import https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/rainbow as rainbow.txt
!curl https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/rainbow -o rainbow.txt
# [ ] Open rainbow.txt in read mode & read as list with .readlines()
rainbow_file = open("rainbow.txt")
rainbow_colors = rainbow_file.readlines()
# [ ] sort rainbow_colors list, iterate the list to print each color
rainbow_colors.sort()
for color in rainbow_colors:
print(color)
# [ ] The Weather: import world_mean_team.csv as mean_temp.txt
!curl https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/world_temp_mean.csv
# [ ] The Weather: open file, read/print first line, convert line to list (splitting on comma)
mean_temp = open("mean_temp.txt", "r")
headings = mean_temp.read(1)
print(headings)
mean_temp_list = headings.split(",")
print(mean_temp_list)
# [ ] The Weather: use while loop to print city and highest monthly average temp in celsius
city_temp = ""
while city_temp:
city_temp_list = city_temp.split()
break
for city in city_temp:
print(city)
mean_temp.close()
print(mean_temp)
# [ ] use curl to download https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/digits_of_pi as pi.txt
!curl https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/digits_of_pi -o pi.txt
# [ ] Set up the project files and initial values
pi_text = open("pi.txt", "r")
name = input("enter your name: ")
print("Hi", name + "!")
seed = len(name)
pi_text.seek(0)
digit = pi_text.readline()
guess = input("enter a single digit guess or q to quit: ")
correct = 0
wrong = 0
while True:
if digit == ".":
pass
elif digit == "\n":
seed += 1
seed.seek(0)
else:
if guess == digit:
print("correct")
correct += 1
else:
print("incorrect")
wrong += 1
break
print("The statement is", correct)
print("The statement is", wrong)
pi_text.close()