Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Why is the function returning None for a * b instead of number?
Post: RE: Why is the function returning None for a * b i...
@buran - Yes, I could have messed up with my interpretation. Thanks for the suggestion.
@perfringo - Thanks a ton for clearly explaining it.
and @deanhystad - Thanks for the better way of coding. I wa... |
|
omm |
General Coding Help |
10 |
4,289 |
Nov-05-2020, 01:17 PM |
|
|
Thread: Why is the function returning None for a * b instead of number?
Post: RE: Why is the function returning None for a * b i...
(Oct-28-2020, 11:01 AM)jefsummers Wrote: Your print statement prints the result of function seven. If seven does not return anything, print will print none. Seven may call op and op will return valu... |
|
omm |
General Coding Help |
10 |
4,289 |
Oct-28-2020, 12:25 PM |
|
|
Thread: Why is the function returning None for a * b instead of number?
Post: RE: Why is the function returning None for a * b i...
@perfringo
Even without return statements of five, seven and times etc, the op function was still able to fetch the values of a, sign, b and able to print values until before return statement. But wh... |
|
omm |
General Coding Help |
10 |
4,289 |
Oct-28-2020, 10:49 AM |
|
|
Thread: Why is the function returning None for a * b instead of number?
Post: RE: Why is the function returning None for a * b i...
(Oct-28-2020, 05:31 AM)omm Wrote: Problem: Write calculations using functions and get the results. Let's have a look at some examples:
seven(times(five())) # must return 35
This small function is ... |
|
omm |
General Coding Help |
10 |
4,289 |
Oct-28-2020, 10:44 AM |
|
|
Thread: Why is the function returning None for a * b instead of number?
Post: Why is the function returning None for a * b inste...
Problem: Write calculations using functions and get the results. Let's have a look at some examples:
seven(times(five())) # must return 35
This small function is working as expected and returning 7 ... |
|
omm |
General Coding Help |
10 |
4,289 |
Oct-28-2020, 05:31 AM |
|
|
Thread: XOR solution explanation needed.
Post: RE: XOR solution explanation needed.
Thanks for the clear and elaborate explanation.
(Oct-26-2020, 04:09 AM)deanhystad Wrote: A number XOR itself is zero, and a number XOR with zero is the number.
3 ^ 3 == 0 and 3 ^ 0 == 3, therefore... |
|
omm |
Homework |
7 |
3,133 |
Oct-26-2020, 06:30 AM |
|
|
Thread: XOR solution explanation needed.
Post: RE: XOR solution explanation needed.
(Oct-25-2020, 09:21 AM)buran Wrote: Please, don't edit post after you get reply. Now my post does not correspond to the content of your post.
Got it. Would never repeat it. |
|
omm |
Homework |
7 |
3,133 |
Oct-25-2020, 01:03 PM |
|
|
Thread: XOR solution explanation needed.
Post: RE: XOR solution explanation needed.
(Oct-25-2020, 06:30 AM)omm Wrote: Question:
For a given list of numbers, only one digit is repeated odd number of times. Pass the list through function and return the number which is repeated odd nu... |
|
omm |
Homework |
7 |
3,133 |
Oct-25-2020, 08:45 AM |
|
|
Thread: XOR solution explanation needed.
Post: XOR solution explanation needed.
Question:
For a given list of numbers, only one digit is repeated odd number of times. Pass the list through function and return the number which is repeated odd number of times.
I have a solution fo... |
|
omm |
Homework |
7 |
3,133 |
Oct-25-2020, 06:30 AM |
|
|
Thread: Trying to write func("abcd") -> "abbcccdddd"
Post: RE: Trying to write func("abcd") -> "abbcccdddd"
(Oct-22-2020, 08:43 AM)perfringo Wrote: Another way of doing it: 'multiply letter with it's queue number and join all letters to string'
>>> s = 'abcd'
>>> ''.join(i*char for i, c... |
|
omm |
General Coding Help |
8 |
4,082 |
Oct-22-2020, 09:13 AM |
|
|
Thread: Trying to write func("abcd") -> "abbcccdddd"
Post: RE: Trying to write func("abcd") -> "abbcccdddd"
(Oct-22-2020, 07:57 AM)Axel_Erfurt Wrote: def tag(s):
count = len(s)
for i in range(count):
res = f"{s[:1]}{''.join([char*2 for char in s[1:]])}"
return res
print(tag("Tom")... |
|
omm |
General Coding Help |
8 |
4,082 |
Oct-22-2020, 09:11 AM |
|
|
Thread: Trying to write func("abcd") -> "abbcccdddd"
Post: Trying to write func("abcd") -> "abbcccdddd"
For passing a parameter 'abcd' to function tag, the following result is expected tag("abcd") -> "abbcccdddd"
Now I am trying to append these values to '' empty string but, not getting the result
... |
|
omm |
General Coding Help |
8 |
4,082 |
Oct-22-2020, 07:27 AM |
|
|
Thread: Trying to access next element using Generator(yield) in a Class
Post: RE: Trying to access next element using Generator(...
(Oct-19-2020, 02:02 PM)DeaD_EyE Wrote: Calling __next__ directly is not the best idea.
This line will call the function, which returns a generator.
The generator keeps the state. Then you're callin... |
|
omm |
General Coding Help |
2 |
1,966 |
Oct-19-2020, 03:36 PM |
|
|
Thread: Trying to access next element using Generator(yield) in a Class
Post: Trying to access next element using Generator(yiel...
I have created a Class and used generator in a method which is supposed to yield even numbers between start and stop range. When trying to use next() of yield from the Class Obj, it is printing the sa... |
|
omm |
General Coding Help |
2 |
1,966 |
Oct-19-2020, 01:30 PM |
|
|
Thread: basic question about tuples and immutability
Post: RE: basic question about tuples and immutability
This is your current code output
Enter the student's name (or type exit to stop): one
Enter the student's score (0-10): 1
Enter the student's name (or type exit to stop): two
Enter the student's score... |
|
omm |
General Coding Help |
6 |
2,896 |
Oct-18-2020, 02:47 PM |
|
|
Thread: basic question about tuples and immutability
Post: RE: basic question about tuples and immutability
You can't add or delete elements to tuple but, the existing elements can be modified if they are mutable type.
>>> tup = (1,'a',[1,2])
>>> tup[2][1]
2
>>> tup[2][1] = 3
&... |
|
omm |
General Coding Help |
6 |
2,896 |
Oct-18-2020, 01:50 PM |
|
|
Thread: tkinter - unexpected output - don't know how func is triggered before calling
Post: RE: tkinter - unexpected output - don't know how f...
SOLUTION FOUND:
dir() accepts Object parameter butI was passing Stringtype which wasn't working. So, finally, I have changed the argument lib being passed to dir() as Object.
I have added the follow... |
|
omm |
GUI |
8 |
4,490 |
Dec-11-2018, 05:05 PM |
|
|
Thread: tkinter - unexpected output - don't know how func is triggered before calling
Post: RE: tkinter - unexpected output - don't know how f...
(Dec-06-2018, 06:30 PM)nilamo Wrote: (Dec-06-2018, 05:21 PM)omm Wrote: enter_button = Button(window,text="Enter",command=lambda:lib_func(str_var.get()))If you want the StringVar, why not just pass... |
|
omm |
GUI |
8 |
4,490 |
Dec-11-2018, 12:14 PM |
|
|
Thread: tkinter - unexpected output - don't know how func is triggered before calling
Post: RE: tkinter - unexpected output - don't know how f...
(Dec-06-2018, 11:01 AM)Gribouillis Wrote: Use command=lambda: lib_func(str_var.get()). The lib_func needs to be executed when you press the button, not when the button is created.
Thanks for your he... |
|
omm |
GUI |
8 |
4,490 |
Dec-06-2018, 05:21 PM |
|
|
Thread: tkinter - unexpected output - don't know how func is triggered before calling
Post: tkinter - unexpected output - don't know how func ...
This is how my app looks like in the image below
[Image: https://ibb.co/4jBdPFH]
WHAT I AM TRYING TO DO:
I am trying to create a desktop app using tkinter where I have a Entry (Textbox) to enter a mo... |
|
omm |
GUI |
8 |
4,490 |
Dec-06-2018, 10:53 AM |