Profile icon # Seth Elder

@SethElder1
shared a Post
11 months ago
1
how do i get it to work?
so waht im trying to do is create a code that takes user, initail investment value, intrest rate, how long the investment is active, and how long it n Python  Spacecraft
I helped you with a couple bugs. Variables m and l needed to be integers. Variable r was clarified to be % anually. The output function needed to use the variable t for each month to calculate properly. def info(): i = float(input("initial investment: ")) r = float(input("intrest rate % annually: "))/100 m = int(input("how long are you investing in months?: ")) l = int(input("how long has your investment been going? ")) return(i, r, m, l) def calculate(i, r, m, l): d = i(1 + (r/1211 months ago
what is wrong here? im trying to make it show all the factors of a user inputted number Python
so im trying to get the code to run until the user guesses the right number, but for some reason, even if the user guesses the right answer, it still Python  widz
simply x need to be the first line import random x = random.randint(0, 10) while 1: print("guess a number from 1 to 10, then i will say a random number, and we will see if you get it right,") n = int(input("guess a number from one to ten:")) if n == x: print("Congradulations, thats correct") break else: print("so you were wrong, good luck next time")11 months ago  SixBeeps
This is a very common issue seen in new developers (especially ones who are learning Python or JavaScript, in your case Python) where you are trying to compare two values which are of different types. When you call input(), it will always return a string. If you type in 12, it will be the string "12". Calling random.randint() will always return a number, never a string. Because of this, and input and a random number will never directly be the same. "12" is not the same as 12. If you want to p1 year ago
what is wrong with that "if:" statement? Python
i cant seem to get this formula to work, i dont know why the one "try" statement to work, any ideas Python  JustCoding123
There were some indentation errors, the fixed code is: try: n = input("be kind to your x") except: print(" Invalid") try: s = input("-footed y") except: print(" Invalid") try: o = input("for a duck may be somebody's z") except: print(" Invalid") try: s = input("bekind to your s") except: print(" Invalid") try: p = input("in p") except: print(" Invalid") try: a = input("where the weather is always a") except: print(" Invalid1 year ago