May I suggest you use regular expressions?
You can check it out here (take note of the difference between search,
findall etc):
https://docs.python.org/3/library/re.html
Essentially it is a standard library built for matching patterns in
strings. It is a powerful tool that is kind of it's own lan
Hi Python,
I am trying to make a french to English dictionary. First of all, I made a
dictionary with keys and values. Then I asked the user to enter a letter. If
the letter correspond to the Keys, my print function should display the Key and
value. But my code below, could not . Thank you!
Lis
So show us what you did. Its hard to figure out what's
gone wrong when we can't see your code:That is what I did:
from sympy import*from tkinter import*from sympy import init_printing
root =
Tk()root.geometry("450x350+500+500")root.title("Factorisations/Simplifications")root.configure(background
On 06/09/17 06:34, Pat Martin wrote:
> but my script returns 0. Since they want it to find 2 from the bobob in the
> string using "bob in s" doesn't work (it only returns 1).
Your code has bugs and Cameron has addressed those along
with general advice on how to debug your code in future.
However
On 6 September 2017 at 08:39, edmundo pierre via Tutor wrote:
> Hi Python,
> I am trying to make a french to English dictionary. First of all, I made a
> dictionary with keys and values. Then I asked the user to enter a letter. If
> the letter correspond to the Keys, my print function should dis
On 06/09/17 08:09, edmundo pierre via Tutor wrote:
> So show us what you did. Its hard to figure out what's
> gone wrong when we can't see your code:That is what I did:
> from sympy import*from tkinter import*from sympy import init_printing
> root =
> Tk()root.geometry("450x350+500+500")root.titl
I knew it was an assignment I just couldn't see it no matter how hard I
looked at the code. Thanks for the tips on printing the variables, I was
printing them right after the if statements not at the beginning and ending
of the loop. I will remember that about True/False and comparisons thanks
for
I got it working for all the tests, but the code is ugly. I think regex or
using string methods would have been easier and neater but like I said we
hadn't covered it in the class yet so didn't think I should use it. I am
embarrassed by how bad the code looks to me.
I am self taught and have writt
On 06Sep2017 09:12, Pat Martin wrote:
I got it working for all the tests, but the code is ugly. I think regex or
using string methods would have been easier and neater but like I said we
Always go for string methods first. Regexps are cryptic and easy to get wrong,
and relatively hard to debu