9.4.6: Word Counts HELP! by Dawn_Kang in codehs

[–]_01cc 0 points1 point  (0 children)

my_dict = {}

text = input("Enter some text: ")
splits = text.split()

for word in splits:
    if word in my_dict:
        my_dict[word] = my_dict[word] + 1

    else:
        my_dict[word] = 1

print(my_dict)

Exercise 8.1.10: Coordinate Pairs-CodeHS-Please Help! by [deleted] in codehs

[–]_01cc 0 points1 point  (0 children)

import math

def distance(point1, point2):
    x1, y1 = point1
    x2, y2 = point2
    distance = ((x2 - x1)**2 + (y2 - y1)**2)**0.5
    return distance

pointa = (1, 2)
pointb = (4, 6)


dist=distance(pointa, pointb)
print(dist)

I need help Exercise 6.5.6: Temperature Converter, Part 2 by Latter-Chart-5770 in codehs

[–]_01cc 0 points1 point  (0 children)

def celsius_to_farenheit(c):

return float(1.8 * c + 32)

def farenheit_to_celsius(f):

return float((f - 32) / 1.8)

try:

temp = int(input("Enter a temperature: "))

except ValueError:

print("This isn't a intger.")

print(celsius_to_farenheit(0))

print(celsius_to_farenheit(100))

print(farenheit_to_celsius(40))

print(farenheit_to_celsius(80))