[Solved] Python – Error in my program

Python interprets parens next to an object as “try to call this object”. If you want to multiply two things together, you need to explicitly tell python to multiply. So it should be: R1 = ((33192)*e)**3583*((1/T)-(1/40)) (added asterisk between 3583 and ((1/T)-(1/40))) Edit: Right, that number is too large for float Using decimal to deal … Read more

[Solved] Do string representations of dictionaries have order in Python 3.4?

Note: Python 3.6 introduces a new, order-preserving implementation of dict, which makes the following obsolete from 3.6 onwards. Here are three iterations of your example in three different Python 3.4 interpreter sessions: Python 3.4.1 (default, Aug 8 2014, 15:05:42) [GCC 4.8.2] on linux2 Type “help”, “copyright”, “credits” or “license” for more information. >>> d={} >>> … Read more

[Solved] Pickle user inputs – Python 3 [closed]

The following runs well. Rename your Player class with an uppercase initial to avoid name conflicts. I added some test calls at the end, and the player is loaded with the intended (not default) stats. import pickle class Player: def __init__(self, hp, dmg): self.hp = hp self.dmg = dmg def save(obj): save_file = open(‘save.dat’, ‘wb’) … Read more

[Solved] Python: Looping issue or indentation

Your main issue was that you weren’t prompting them in the loop. import random x = random.randrange(1,1000) counter = 0 while True: guess = int(input(“I have a number between 1 and 1000. Can you guess my number?\nPlease type your first guess.”)) if guess == x: print (“Excellent! You guessed the number in”, counter,”tries.”) break else: … Read more