Skip to content
Sign upLog in
Profile icon

Seth Elder

@SethElder1
Repls
Community
SethElder1
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
investments
Python
Spacecraft
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
SethElder1
SethElder1
how do i do that? @CosmicBear11 months ago
MrVoo
MrVoo
Don't say "it isn't working", tell what happened and what you wanted to happen. You put everything in functions, but never ran the functions.11 months ago
SethElder1
SethElder1
shared a Post
11 months ago
1
what is wrong here? im trying to make it show all the factors of a user inputted number
factoring
Python
TheDNAHero
TheDNAHero
The number that you input is a string, not a number. You need to do n=int(input("Input your number ")) I forked the repl and did it: https://replit.com/@TheDNAHero/factoring#main.py11 months ago
SethElder1
SethElder1
shared a Post
1 year ago
1
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
random number
Python
widz
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
Spacecraft
Spacecraft
Inputs are always in the form of a string, even if they are numbers. You are trying to compare a string and an integer, so they never match. Either convert the input into an integer or convert the random number into a string and then compare them.1 year ago
SixBeeps
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
SethElder1
SethElder1
shared a Post
1 year ago
1
what is wrong with that "if:" statement?
random number
Python
MrVoo
MrVoo
You did it compleeeeetely wrong, change it to this: if n == x: print("Congradulation, thats correct") else: print("sorry, that was incorrect") You need indentation and proper syntax1 year ago
SethElder1
SethElder1
shared a Post
1 year ago
i cant seem to get this formula to work, i dont know why the one "try" statement to work, any ideas
Mad lib
Python
JustCoding123
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