leading zero causes an exception in the program [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 months ago.
Improve this question
i hope you are doing well.
I have a question maybe it is stupid to ask rather than search.
but I looked up for a satisfactory answer.
Why leading zero is not allowed in some language, such as python.
what problems can leading zero produce?
thanks in advance!

This is not just in Python, many programming languages doesn't allow leading zeros. This is because zero is used to define if number is for example binary or octal base numbers. More about them in Python here.

Related

Is there a way to compute the cosets of D<sub>2n</sub> in <i>S</i><sub><i>n</i></sub> [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Although this is a question of maths but I really wanted to figure out if something like this is possible or not by coding it .(preferably in C). I had the question posted in mathsstackexchange where I saw that there's a way to find out the cosets of D_12 in S_6 by using Python programming. Can someone just help me to figure out how are we doing this?
S_n is the group formed by all possible permutations of n-elements and D_2n is formed by the generators <r, s> where r =(123, n) and s=(1n)(2 n-1).
Here's the link to the answer
https://math.stackexchange.com/questions/3880306/find-the-cosets-of-d-2n-in-s-n
Also I am not accustomed to posting questions in stackoverflow, I really don't know how to add mathematical symbols.
Though the logic remains same, the implementation will vary from Python to c due to difference is data types and so on. So you should try learning Python, it’s very easy to learn and you can pick up writing code in Python within few days considering you already you know a few other languages. And writing such complex programs can be easy in Python due to the vast inbuilt libraries and readability. So it’s better if you learn Python and start implementing this in Python.

Remove particular character from a string python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have to remove this: ® Character from a string in Python.
Whole string is:
'Rainbow® Super Value Construction Paper, 12" x 18", Assorted Colors, Pack Of 100'
There is a translate method to deal with unwanted characters, but probably
string.replace('®', '')
is easier to write.

save scale data and recall data back into scale [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to create a code that will take 24 scale values and save them in a txt. file, i then want to be able to recall these values and put them back into the 24 scales. can someone point me in the right direction.
Thanks
First read this :
http://docs.python.org/2/library/stdtypes.html#bltin-file-objects
then write some code and come back with concrete questions if necessary.

Function to Return Smallest Value (Python) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need help on a programming assignment. I am completely lost on this one. If anyone could help, that would be great. The programming language is in Python.
Write a function called smallest() that will take three numbers as parameters and return the smallest value. If more than one number tied for smallest, still return that smallest number. DO NOT use the built in min() Python function to do this.
6,3,5 -> 3
4,4,8 -> 4
3,7,2 -> 2
1,8,9 -> 1
9,0,6 -> 0
Well you didn't say you can't use the builtin max function, so
def smallest(*args):
return max(*args, key=lambda x:-x)

Python-Convert int to bin [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a number on int format, but I want that the same algarisms make a binary number
so I could make binary operations with that number, how can I do that?
number = 1010111
Python includes the builtin function bin() to do this.
However, this just creates a string of the binary representation. This is completely unnecessary to do any sort of "binary operations" on a number, which can all be done on a normal int.
use the builtin function bin() to output in binary and the 0b1010111 format for input.

Categories

Resources