Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Issue with logic in homework
Post: RE: Issue with logic in homework
(May-24-2018, 02:12 AM)Larz60+ Wrote: what idx < idx1 is actually saying is, if bad comes before good then do
and if either bad or good is not in the string an exception will be raised.
So you n... |
|
fad3r |
Homework |
5 |
3,617 |
May-24-2018, 02:42 AM |
|
|
Thread: Issue with logic in homework
Post: RE: Issue with logic in homework
I also don't understand why if I change it to "bad" and "not" it still changes This tea is not hot. How could it match on those conditions?
(May-24-2018, 12:50 AM)Larz60+ Wrote: You should change ... |
|
fad3r |
Homework |
5 |
3,617 |
May-24-2018, 12:57 AM |
|
|
Thread: Issue with logic in homework
Post: Issue with logic in homework
Hi,
So my homework is to look at 3 strings. If the string has not before bad I am suppose to replace the everything between not and bad with good.
So the strings are:
This movie is not so bad
This d... |
|
fad3r |
Homework |
5 |
3,617 |
May-24-2018, 12:41 AM |
|
|
Thread: UnboundLocalError: local variable 'a' referenced before assignment
Post: UnboundLocalError: local variable 'a' referenced b...
Hi again,
I am working on more homework. I have ideas of how to solve the problem but I am running into a bug I don't understand
def not_bad(s):
t = s.split()
for x in t:
if x == "no... |
|
fad3r |
Homework |
3 |
16,557 |
May-23-2018, 04:21 PM |
|
|
Thread: Issues with Lambda Function
Post: RE: Issues with Lambda Function
(May-22-2018, 03:58 PM)ThiefOfTime Wrote: The Problem is that any numerical operand is only defined for values (int, double, long, etc.) not for lists.
the first solution that pops into my mind is:
... |
|
fad3r |
Homework |
5 |
3,682 |
May-22-2018, 04:13 PM |
|
|
Thread: Issues with Lambda Function
Post: RE: Issues with Lambda Function
(May-22-2018, 03:51 PM)buran Wrote: you need list comprehension in the lambda
The list comp does help but it returns boolean expression unless I did it wrong?
my_list = [1, 5, 4, 6, 8, 11, 3, 12]
t... |
|
fad3r |
Homework |
5 |
3,682 |
May-22-2018, 04:10 PM |
|
|
Thread: Issues with Lambda Function
Post: Issues with Lambda Function
Hi,
I am trying to wrap my head around lambda but I am running into issues.
The homework question is: Write a lambda function that takes a list my_list and returns a list which includes only even num... |
|
fad3r |
Homework |
5 |
3,682 |
May-22-2018, 03:27 PM |
|
|
Thread: Question about testing for equivlance
Post: RE: Question about testing for equivlance
(May-08-2018, 07:51 PM)j.crater Wrote: There is a great tutorial on the subject on our forums.
Wow that was fantastic. Too bad he didnt cover integers cause I have some problems with those and if y... |
|
fad3r |
Homework |
4 |
3,000 |
May-08-2018, 08:01 PM |
|
|
Thread: Question about testing for equivlance
Post: Question about testing for equivlance
Hi,
I am clearly confused on testing for equivlance.
Why does the below print yes even though roll is not set to a matching number?
roll = 12
if roll == 6 or 7 or 11 or 16 or 19:
print ("yes")
... |
|
fad3r |
Homework |
4 |
3,000 |
May-08-2018, 07:19 PM |
|
|
Thread: having an issue with nested if statements
Post: RE: having an issue with nested if statements
The problem I am running into with using all if statements is the code keeps overwriting itself. I thought I could use break to get out of it but apparently that doenst work with if statements
#roll... |
|
fad3r |
Homework |
6 |
4,665 |
May-07-2018, 07:36 PM |
|
|
Thread: having an issue with nested if statements
Post: RE: having an issue with nested if statements
I managed to figure out the answer in post 2 thank you. I will review the post 3 part. Thanks!
I originally used numbers 0 and 1 for on and off the base but I found this confusing. t / f was just ... |
|
fad3r |
Homework |
6 |
4,665 |
May-07-2018, 04:10 PM |
|
|
Thread: having an issue with nested if statements
Post: having an issue with nested if statements
Hi,
I am trying to design a baseball game based on a dice roll for fun.
I am having an issue with nested ifs
from random import randint
manonbase={'1':'f', '2':'f', '3':'f'}
team1runs=0
team2runs=0
... |
|
fad3r |
Homework |
6 |
4,665 |
May-07-2018, 03:53 PM |
|
|
Thread: Issues with printing a variable
Post: Issues with printing a variable
Hi,
I am back to working on homework and I have a very simple problem that I can't seem to figure out
I am trying to print a variable as part of a string and it doenst seem to like it
# Create a pro... |
|
fad3r |
Homework |
1 |
2,174 |
May-03-2018, 06:23 PM |
|
|
Thread: Trying to get the week number from a string of numbers
Post: Trying to get the week number from a string of num...
Hi,
I am parsing a json file and the string it returns the date as looks like this:
'2018-03-31T00:19:38Z'
This is ISO 8601 format. I have looked at various libraries to try to parse this and have g... |
|
fad3r |
Homework |
2 |
3,211 |
Apr-15-2018, 03:12 PM |
|
|
Thread: Pass 2 columns via loc to lambda in pandas
Post: Pass 2 columns via loc to lambda in pandas
Hi everyone,
I am working on something that calculates a bmi. I have it solved a certain way but my friend told me it was non pythonic and to solve it using loc and lambda.
I have spent the day w... |
|
fad3r |
Homework |
1 |
7,912 |
Feb-21-2018, 11:05 PM |
|
|
Thread: Why can't I force an int to be a string?
Post: RE: Why can't I force an int to be a string?
You're a genius Larz. Thank you buddy. |
|
fad3r |
Homework |
4 |
3,390 |
Feb-13-2018, 11:17 PM |
|
|
Thread: Why can't I force an int to be a string?
Post: RE: Why can't I force an int to be a string?
I want E to be string instead of a integer so that list1 can be used in zip otherwise I get:
File "C:/Users/c0unt3rpl4y/PycharmProjects/House/Challenges/Archive/Challenge 6.py", line 52, in <mod... |
|
fad3r |
Homework |
4 |
3,390 |
Feb-13-2018, 11:00 PM |
|
|
Thread: Why can't I force an int to be a string?
Post: Why can't I force an int to be a string?
It just doesn't work. I am familiar with str(10).
Here is my code. This is driving me crazy.
#Inputs
b = " is awesome"
c = 10
list1 =[]
output_dict={}
input_list = ['mike', 1, 'leon', 2, 'david', ... |
|
fad3r |
Homework |
4 |
3,390 |
Feb-13-2018, 10:46 PM |
|
|
Thread: Find not working properly
Post: RE: Find not working properly
This last post was amazing and just explained so much. Just added it to my evernote notes.
Thank you!! |
|
fad3r |
Homework |
2 |
2,487 |
Feb-11-2018, 03:18 PM |
|
|
Thread: Find not working properly
Post: Find not working properly
Hi,
A friend is mentoring me on python (thus the world list we are using)
My challenge is in 1 line code to find all the words that have s in them.
I am fairly new to list comprehensions but are sta... |
|
fad3r |
Homework |
2 |
2,487 |
Feb-11-2018, 02:38 PM |