Farheen Palagiri
@FARHEENPALAGIRI
Hi everyone. I've been working on this code for like three weeks and I have no idea how to do it. So basically the code tells you how many pairs of eq
Python
mwilki7 Just a few questions to help me know how the program should behave.
What is an equal pair?
Is the array layed out like:
[
[a,b],
[c,d],
......,
]
or
[
a,
b,
...,
]
Does a list containing [1,1,1] have 2 equal pairs?4 years ago
Hello everyone. Quick question: when you are using REPL to code, does the terminal ever blank out on you? It does that to me all the time and it's rea
TheDrone7 Yes, 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.4 years ago
Hello everyone! Me again. I have a question, but it's fairly straightforward. It's not exactly about code. How does the Debug Mode work on REPL?
Hello everyone. How are you? I'm back, so you're probably annoyed. So, anyways, I was writing this code, and I'm not sure how to do something. Help me
ArchieMaclean if (a[e]+1)==a[e+1] or (a[e]-1)==a[e+1]:
print(a[e]+" "+a[e+1]
Please upvote if this helps :)4 years ago
Scoder12 What 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!4 years ago
Hi everybody. It's me again. And I'm still stuck on the same code despite all your effort to help me. I'm sorry. But could someone please explain to m
a5rocks Here 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:
continue
end += start[i]
print(end)
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.4 years ago
Nanashi As of writing, you have this:
s = input()
x = 0
for i in range(len(s)):
if x > len(s):
break
else:
l = s[x]
s2 = s.replace(l,'')
x += 3
print(s2)
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[6], 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 it4 years ago
Hey guys. Me again. I need help. Serious help. Like, I've-been-working-for- almost-2-hours-and-have-no-idea-what-is-happening help. I'm just gonna pos
a5rocks Why 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.4 years ago
Hi there, everyone. How are you? Good? Great. Me? Not so much. I have, you guessed it, run into a coding problem. I have absolutely no idea how to do
Hi everyone. It's your's truly. I have absolutely no idea what it is that I am supposed to do here on this code that I am working on. So I was told on
Hey everyone, it's me. Again. And, as usual, I am an idiot and can't figure out how to write this code. Help me please?
Okay so I'm writing this code
Brandaboss This works for me:
N = int(input("Amount of numbers: "))
total = 0
for i in range(N):
numb = int(input("Number "+str(i+1)+": "))
total += numb
print(total)
Tell me if it helps.4 years ago
TopZek I think you should send HappyFakeboulde the multiplayer link ; copy the code down first if he accidentally erases it.4 years ago
Hey guys. Wassup?? Well, I was trying to write this code for like two days now and I am just extremely stuck. Like can someone please help me?? I am s
PYer Instead 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.4 years ago
Hey everyone. I have a not-so-slight issue. So for this code I'm writing, a three digit number is inputted, and if the digits are in ascending order t
Geocube101 You 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 =4 years ago
ash15khng You 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:
numlist2.append(num)
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.4 years ago
HappyFakeboulde AFAIK map doesn't return a list, it returns an iterator.
I could be wrong though :shrug:.4 years ago
Hi everyone. Me again. I need help with a program I'm working on (as usual). So in this code there are two numbers inputted. If exactly one is negativ
CodeLongAndPros Here'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):
print("YES")
else:
print("NO")
`3 years ago
safan41 your 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:
...
)4 years ago
Hi everybody, it's me again. I need you to look at something. So the situation was that a school was replacing the desks of 3 classrooms. Each desk ho
OmniShift Since 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 :)4 years ago
Help me please. I have no idea how I'm supposed to do this. So I've been working on this code, and (to me at least) it's very confusing. So the input
CoolqB Your 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.4 years ago
Hi. I'm sorry, I ran into a problem. Just one quick question: I want the answer of two different equations in one sentence(sentence? idk). I tried t
pyelias To solve this problem, I'd check the documentation for print.
It says:
> 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.4 years ago
JosephBarroso Can you post your code? It'd be easier to find what the problem was if I can see the code :)4 years ago
Hi everybody, it's me again. Don't worry I'm not going to bother you about codes that I find really difficult (yet), I'm just honestly curious about
pyelias I 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.4 years ago
Hi. Me again. I know I'm probably really annoying you all with my constant questions, but I just really suck at this. I've been working on this code f
Geocube101 You 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[1])4 years ago
Okay so I am trying to write a code where you enter a number, any number, and the program will print the last two digits. So code I wrote basically tu
Geocube101 You 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-FARHEENPALAGIRI4 years ago
So I was trying to write this code for this situation:
Write a program that reads an integer number and prints its previous and next numbers
To solv
AzureScripts I 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 works4 years ago
CoolqB The 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!4 years ago