operators

Array If-And Condition Not Working As Planned {Python}

Array If-And Condition Not Working As Planned {Python} Question: I have a program where, given a sequence of numbers within an array, the goal is to check whether or not no more than one value can be taken out to make the sequence a strictly increasing sequence. One of my conditions is to check whether …

Total answers: 1

What does ^ do in python?

What does ^ do in python? Question: I’ve stumbled upon ^ operator in python, and I don’t understand what is does. I couldn’t find anything about it online. Asked By: ColorfulYoshi || Source Answers: The ^ operator in Python is known as the bitwise XOR operator. It performs a binary XOR operation on two operands …

Total answers: 2

How do I calculate operations from a txt file?

How do I calculate operations from a txt file? Question: So I have a homework to write those expressions in a notepad, this is my input file: 4+1 12-3 2*182 8/2 then, I have to write a program in idle that will read that, line by line, that will solve the operations and return them …

Total answers: 1

What does ^ operator do in Python?

What does ^ operator do in Python? Question: I’ve tried the following: print(1^3) #output 2 print(1^5) #output 4 print(1^6) #output 7 These outputs don’t make any sense for me. Asked By: Victor Rayan || Source Answers: It’s the bitwise XOR operator. Answered By: RedBox

Total answers: 1

Using multipe operators in Python sequentially

Using multipe operators in Python sequentially Question: I’m trying to understand how Python handles using multiple sequential operators to add and subtract numbers. Here is an example of what I mean: >>> 5+-2 3 >>> 5-+2 3 >>> 5+-+-+2 7 >>> 5+-+-+-2 3 >>> 5+-+—+2 7 >>> 5-+-+—+2 3 >>> 5-+-+—+-2 7 >>> 5++++-++++–+-+++2 7 …

Total answers: 3

Operation_Precedence_in_Python

Operation_Precedence_in_Python Question: Could someone explain to me about operator precedence? For eg. Modulo(%), integer division(//), exponential(**) What comes first, second, third and so on. Also please help me with the output of the following code and with step by step explanation: print(8 % 3 ** 4 // 3 + 2) I coudnt understand about Operator …

Total answers: 1

Python NOT equal operator combining with OR operator

Python NOT equal operator combining with OR operator Question: piece of example code: while input("Type STOP to stop this program: ") != (‘STOP’ or "stop"): continue The program doesn’t give the correct output when inputted: stop. Why does STOP work but lower case doesn’t? Asked By: Jelle || Source Answers: You can convert the input …

Total answers: 2

Get the season when entering a month and day (python)

Get the season when entering a month and day (python) Question: I am writing a code that allows the user to enter a month and date and the program will tell them what season it will be given the information that the user entered. What I currently have working is that when you enter certain …

Total answers: 2

compare two attribute of objects from different list of object python

compare two attribute of objects from different list of object python Question: I’m still pretty new to python and oop and I have some struggles resolving this problem without breaking the performance. I want to compare the id of my user (that’s what I have done with the eq function) and if the id is …

Total answers: 3