Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Recursive function
Post: Recursive function
How to change this code to recursive code...
def search(myList, number):
for i in myList:
if i[0] == number:
return i[1]
return None
myList = [(5107261, 'Ernst'), (6524... |
|
janek30 |
Homework |
1 |
2,888 |
May-16-2017, 02:51 PM |
|
|
Thread: Names and codes
Post: RE: Names and codes
Actually, it's a little longer homework...,First, I had to get the data from the file, I got it done......
CODE:
def Children_and_parents(f1, f2):
f = open(f2, encoding = "UTF-8")
ff =... |
|
janek30 |
Homework |
3 |
3,338 |
May-11-2017, 02:40 PM |
|
|
Thread: Names and codes
Post: Names and codes
I have a dictionary to people's names and codes,like this:
Names_and_codes = {"Emily":30623,
'Ethan':21298,
"Chloe":40145,
"Olivia":61834,
... |
|
janek30 |
Homework |
3 |
3,338 |
May-11-2017, 12:27 PM |
|
|
Thread: Incorrect code
Post: RE: Incorrect code
I found the solution......
def ok(a, b, c):
if abs(a - b) <= c or a * b >= 0:
return True
return False
def number(d, e):
f = 0
for i in range(len(d)-1):
... |
|
janek30 |
Homework |
11 |
8,429 |
May-09-2017, 10:06 AM |
|
|
Thread: Incorrect code
Post: RE: Incorrect code
Code compares numbers.
def ok(a, b, c):
if abs(a - b) > c or a * b < 0:
return False
return True
def number(d, e):
f = 0
for i in range(len(d)-1):
if no... |
|
janek30 |
Homework |
11 |
8,429 |
May-08-2017, 04:52 PM |
|
|
Thread: Incorrect code
Post: RE: Incorrect code
Ok I fixed it ,But something's still wrong...This program will return the wrong numbers
def ok(a, b, c):
if abs(a - b) > c or a * b < 0:
return False
return True
def number... |
|
janek30 |
Homework |
11 |
8,429 |
May-08-2017, 04:06 PM |
|
|
Thread: Incorrect code
Post: Incorrect code
I have a Incorrect code ,and I need to find the faults and fix them.
Code:
def ok(a, b, c):
if abs(a - b) < c or a * b > 0:
return False
return True
def number(d, e):
f = ... |
|
janek30 |
Homework |
11 |
8,429 |
May-08-2017, 04:07 AM |
|
|
Thread: List/set
Post: RE: List/set
Thanks Buran! it works....... |
|
janek30 |
Homework |
7 |
5,957 |
Apr-25-2017, 05:13 PM |
|
|
Thread: List/set
Post: RE: List/set
I'm stuck here :
list = [{"a","b","c","d"},{"k","f","r","c"},{"c","a","o","r"},{"m","p","l"},{"i","r","p","b"}]
for i in range(len(list)):
for j in range(i+1,len(list)):
if list[i] &... |
|
janek30 |
Homework |
7 |
5,957 |
Apr-25-2017, 03:35 PM |
|
|
Thread: List/set
Post: RE: List/set
There are five sets in one list, and I need to find 2 most of the same elements .and print their indexs... |
|
janek30 |
Homework |
7 |
5,957 |
Apr-25-2017, 12:52 PM |
|
|
Thread: List/set
Post: List/set
Hi
I need little help.
I have five Set on list. Like this:
list = [{"a","b","c","d"},{"k","f","r","c"},{"c","a","o","r"},{"m","p","l"},{"i","r","p","b"}] How can I find what sets are the resemblanc... |
|
janek30 |
Homework |
7 |
5,957 |
Apr-25-2017, 08:56 AM |