task: Prime numbers in function

Problems with Logic The function you wrote is meant to calculate how many dividers are in the numbers from a-b, which is different than what the prompt is asking. You’re on the right track with the loops and the % (mod) if statement, but you’re off by a bit. In order to calculate the number … Read more

How to read a single object from a json file containing multiple objects using python? [closed]

Try adding adding an if parameter to check if its the desired item that your looking for, then just record all of its information. import json with open(‘elements.json’) as f: data = json.load(f) choice = input(“Choose element: “) for element in data[‘Elements’]: if element[‘name’] == choice: for x, y in element.items(): print(x.title() + “-> ” … Read more