Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #def compareStrings(x,y):
- # if len(x) != len(y):
- # return max(x,y,key=len), "är störst!"
- # else:
- # return "Lika stora!"
- #def compareInt(x,y):
- # if x != y:
- # return max(x,y)+ " är störst!"
- # else:
- # return "Lika stora!"
- #def uppgift13(x,y):
- # if x.isnumeric() == False and x.isnumeric() == False:
- # return compareStrings(x,y)
- # elif x.isnumeric() and y.isnumeric():
- # return compareInt(float(x),float(y))
- # else:
- # return "Går inte att jämföra "+x+" med "+y
- #
- #x = input("Skriv in x: ")
- #y = input("Skriv in y: ")
- #print (uppgift13(x,y))
- def uppgift14(temp):
- args = temp.split()
- sort = args[2]
- start = int(args[0])
- stop = int(args[1])
- if sort.upper() == "F":
- toSort = "C"
- else:
- toSort = "F"
- temp_dict = {
- "F":lambda farenheit: (farenheit-32)*(5/9),
- "C":lambda celcius: celcius*((9/5) + 32)
- }
- for x in range(start, stop,10):
- print (x, sort,"=",temp_dict[args[2].upper()](x),toSort )
- test = input("Skriv in exempel 100 200 F ")
- uppgift14(test)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement