TheDrone7Yes, that does happen sometimes to me as well. As a quick workaround, I open the shell by pressing the F1 key and then typing Open Shell in the search box that pops up. In case F1 doesn't work, you can also do Ctrl + Shift + P and then use the command line commands to run the repl.
Unfortunately, this isn't a permanent fix and only a quick workaround, it should help with debugging.3 years ago
a5rocksAt the very least, I don't. Sometime my terminal takes a while to load, or just is stuck loading, but even then I don't care because I don't use it much. Though, once I used repl on tor, and the console wouldn't show anything. (probably just an out of date browser in that case)
You could submit a bug report and/or screenshots here : https://repl.it/bugs3 years ago
21natzilWhat about "12.43".split(".")1?3 years ago
pyeliasI think what happens here is that once you think of a solution, you just use it without consider other possible approaches. Planning is always helpful. (and if your code is too complicated, you're probably doing something wrong)
Even most large projects I've worked on usually have simple code, just a lot of it.3 years ago
Geocube101You can do 'split(".")' to split the float into the numbers before and after the decimal point.
#Get input as string
a = input()
#Split string around point
b = a.split(".")
#Print Part 2 (All objects after the point)
print(b)3 years ago
a5rocksWhy are you repeating the for loop length of the string times?
Also, why s.replace? https://stackoverflow.com/questions/14198497/remove-char-at-specific-index-python
Also, what it total doing?
Thats all I could find quickly.3 years ago
pyeliasTo solve this problem, I'd check the documentation for print.
> print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
> Print objects to the text stream file, separated by sep and followed by end...
The ` before objects means that there can be multiple objects printed. So, you would use print(x y, z * y)` to print both things in one line.3 years ago
JosephBarrosoCan you post your code? It'd be easier to find what the problem was if I can see the code :)3 years ago
Geocube101You could just get the input and send it to an array: a = list(input()) which should return the input as a list with each character as an element (You then need to iterate through and convert each element to an integer via int() method). From there, you can make another list and call the sorted() function to sort it. Compare the first list with the second sorted list and done! If they match, it should return True.
a = list(input())
for b in range(len(a)):
--a[b] = int(a[b])
c = sorted(a)
if a =3 years ago
ash15khngYou could do something like
numlist2 = [int(num) for num in num_list]
This is called a list comprehension and is basically a shorter way of writing
numlist2 = 
for num in num_list:
If you want to use your code, change line 3 to numlist2 = list(map(int, num_list)). map() returns a map object, not a list, so you need to turn in into a list by adding list() in front of it.3 years ago
HappyFakebouldeAFAIK map doesn't return a list, it returns an iterator.
I could be wrong though :shrug:.3 years ago
AzureScriptsI have done what you tried to do in one of my repls: https://repl.it/@AzureScripts/Integer-Help
It is working and it has the same function as you tried to make!
Take a look and tell me if this works3 years ago
CoolqBThe problem here is you're trying to add a string type to an integer. You cannot add a string (a bunch of letters) and a number, because you just can't. To fix this, using the str() function (short for string), tell python to turn the numbers into a string. Try this: print ("the number after " + str(a) + "is " + str(previous)). This is a simplified version of what's really going on here, so I recommend you look up about datatypes, it'll help you a lot!3 years ago
a5rocksHere is something that should work. It uses modular arithmetic to find the third character, and uses continue to skip an interation. Both these are great tools, and I think you should check them out. Anyway, here :
start = input('Your string? ')
end = ''
for i in range(len(start)):
if i%3 == 2:
end += start[i]
Another thing is that you should join the repl.it discord (https://discord.gg/XadDsju), in which you would be able to get more comprehensive help.3 years ago
NanashiAs of writing, you have this:
s = input()
x = 0
for i in range(len(s)):
if x > len(s):
l = s[x]
s2 = s.replace(l,'')
x += 3
And you are getting IndexError: string index out of range. Your code will actually run on a string of length 7 or 8 but not 6 or multiples of 3. Why? When x becomes 6, l tries to become s, meaning the character from indices 6 to 7 (equivalent to s[6:7]), but s has length of 6 not 7 therefore the index is out of range. To stop it3 years ago
ArchieMacleanif (a[e]+1)==a[e+1] or (a[e]-1)==a[e+1]:
Please upvote if this helps :)3 years ago
Scoder12What is the variable e for? couldn't you just use i? As for the solution, just set a variable, such as done to False at the beginning of your program and set it to true if you find a pair. If the variable is still false when you are done with the loop, print 0.
> I am repl.it helper. If this is a good answer, please upvote!3 years ago
FARHEENPALAGIRIWhy shouldn't I use eval?? Does it not always work??3 years ago
PYerInstead of using eval() (Don't it is bad practice) you could just do y = int(x). When you divide a number by another, the answer is always a float (With decimal point), which you then can convert into an integer with the int() function.3 years ago
mat1Never ever ever ever use eval(). Use int() to automatically convert it to an integer instead
> Please upvote my comment if it was helpful or useful in any way :)3 years ago
CodeLongAndProsHere's how I would do it:
a = int(input())
b = int(input())
if (abs(a) == a or abs(b) == b) and (abs(b) != b or abs(a) != a):
`2 years ago
safan41your first if statement checks for if a < 0, which input precedes to be true, meaning the elifs after that won't run. try to put the most specific conditional statements first then down to the least specific. (e.g.
if a < 0 and b < 0:
elif a < 0:
)3 years ago
Geocube101You cannot subtract an int from a string or a list (Line: 4)
Anyway, I subtracted 2 from 'strnum' and added a for loop to remove the first number in 'numlist'. Once done, the result is joined into a string and printed.
New Code: https://repl.it/@Geocube101/Ask-For-FARHEENPALAGIRI3 years ago
ash15khngLine 9, when length of a is 1, you should get a.3 years ago
mwilki7Just a few questions to help me know how the program should behave.
What is an equal pair?
Is the array layed out like:
Does a list containing [1,1,1] have 2 equal pairs?3 years ago
OmniShiftSince you want to calculate for each classroom separately, you should put the input results in a list and loop over it. For each value, use math.ceil as you did and add the result to the total. Its very close to what you already had, just looped and in a slightly different order :)3 years ago
CoolqBYour question is a little vague, are you trying to find the number of degrees between the minute hand and hour hand when the hour is at a certain degree?
If so, the answer is fortunately fairly simple: hours * 30, since a full circle is 360 degrees, every hour is worth 360 / 12 = 30.3 years ago