Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Can anyone spot why this function is returning an empty list?
Post: Can anyone spot why this function is returning an ...
def affine_n_encode(text, n, a,b):
ngraphs=[]
nums=[]
texts=[]
if len(text) % n==0:
for i in range(len(text)):
ngraphs.append(text[i:i+n])
else:
... |
|
hhydration |
Homework |
2 |
1,845 |
Nov-17-2020, 04:27 PM |
|
|
Thread: Trying to integrate gcd function
Post: RE: Trying to integrate gcd function
(Oct-28-2020, 01:34 PM)perfringo Wrote: This is homework and probably some conditions apply. Otherwise I would hae suggested to use built-in math.gcd()
Do you have an idea of how I would integrate m... |
|
hhydration |
Homework |
3 |
2,117 |
Oct-28-2020, 01:58 PM |
|
|
Thread: Trying to integrate gcd function
Post: Trying to integrate gcd function
I have this function, it prints a list of values.def kasinski(text):
trigraphs=[]
distances=[]
for trigraph in range (len(text)-2):
newtrigraph= text[trigraph:trigraph+3]
i... |
|
hhydration |
Homework |
3 |
2,117 |
Oct-28-2020, 12:39 PM |
|
|
Thread: Why does this function print empty list?
Post: Why does this function print empty list?
def kasinski(text):
trigraphs=[]
distances=[]
for trigraph in range (len(text)-2):
newtrigraph= text[trigraph:trigraph+3]
if newtrigraph in trigraphs:
distances.append(... |
|
hhydration |
Homework |
1 |
1,524 |
Oct-28-2020, 01:15 AM |
|
|
Thread: Printing empty list?
Post: Printing empty list?
def kasinski(text):
trigraphs=[]
distances=[]
for trigraph in range (len(text)-2):
newtrigraph= text[trigraph:trigraph+3]
if newtrigraph in trigraphs:
distances.append(... |
|
hhydration |
General Coding Help |
2 |
2,116 |
Oct-28-2020, 12:56 AM |
|
|
Thread: Unspecified syntax error
Post: Unspecified syntax error
def vigenere_encode(message, key):
encoded= ''
for c in range(len(message)):
msg_char_index=alpha.index(message[c])
key_char_index=alpha.index(key[(i% len(key))]
enc_in... |
|
hhydration |
Homework |
1 |
2,001 |
Oct-24-2020, 11:09 PM |
|
|
Thread: When I run this code, nothing happens. Could someone please tell me why?
Post: When I run this code, nothing happens. Could someo...
def guess(x, y):
a = (x+y)//2
print(a)
d = input("Please type high, low, or correct:")
if d == ("correct"):
print("I guessed your number!")
elif d == "high":
... |
|
hhydration |
Homework |
4 |
2,303 |
Oct-20-2020, 03:52 PM |
|
|
Thread: What would be a substitute for "::"
Post: What would be a substitute for "::"
The use of :: is prohibited for certain assignments, what would be a substitute that would allow you to do things like print every other character in a string? |
|
hhydration |
Homework |
1 |
1,568 |
Oct-10-2020, 10:08 PM |
|
|
Thread: Print characters in a single line rather than one at a time
Post: Print characters in a single line rather than one ...
for x in range(len(s)):
if x % 2!=0:
print(s[x])This is the code I am using to print every other character in a string. However, when I run it, it prints the characters like this:
a
b
c
... |
|
hhydration |
General Coding Help |
1 |
2,024 |
Oct-10-2020, 09:43 PM |
|
|
Thread: GCF function w recursion and helper function(how do i fix this Recursion Error)
Post: GCF function w recursion and helper function(how d...
def gcd(x,y):
if x > y:
return gcd_helper(x, y, y)
else:
return gcd_helper(x, y, x)
if x == y:
return gcd_helper(x, y ,x)
def gcd_helper(x, y, f):
f = gcd(x,... |
|
hhydration |
Homework |
3 |
2,524 |
Oct-03-2020, 04:02 PM |
|
|
Thread: Missing positional arguments error??
Post: Missing positional arguments error??
def lattice_moves(n, m, l):
if n==0 and m==0 and l==0:
return 1
elif n==0 and m==0:
return (lattice_moves(n, m, (l-1)))
elif n==0 and l==0:
return (lattice_moves(n,... |
|
hhydration |
Homework |
2 |
2,129 |
Oct-01-2020, 12:47 AM |
|
|
Thread: "RecursionError: maximum recursion depth exceeded in comparison"
Post: "RecursionError: maximum recursion depth exceeded ...
def sum_arithmetic(n_terms, start_val, inc_val):
if n_terms == 0:
return 0
else:
return start_val+ sum_arithmetic((start_val+inc_val), inc_val, (n_terms-1))
print(sum_arithmet... |
|
hhydration |
Homework |
1 |
1,809 |
Sep-26-2020, 02:36 PM |
|
|
Thread: Help me out?
Post: RE: Help me out?
Thanks very much for that hint! Helped me a lot.
def odd_number_digits(n):
if (len(str(n)) % 2 != 0
return TrueThis is what I have so far, however, I keep getting a syntax error message re... |
|
hhydration |
Homework |
5 |
1,970 |
Sep-23-2020, 04:26 PM |
|
|
Thread: Help me out?
Post: RE: Help me out?
I don't really have an idea of what to do. I am currently testing numbers with the floor division and modulus functions. I have found some similar ideas online, but all contained the while loop which ... |
|
hhydration |
Homework |
5 |
1,970 |
Sep-23-2020, 02:58 PM |
|
|
Thread: Help me out?
Post: Help me out?
I need help creating a boolean function that will return True if the input has an odd number of digits. No luck so far. Anyone know how to do it, without using a while loop, or advanced python functio... |
|
hhydration |
Homework |
5 |
1,970 |
Sep-23-2020, 02:47 PM |