Hello, I am working on the following assignment where “tip” is an invalid
syntax. Can someone please tell me how to fix this? Here is what it should look
like:
Welcome to Restaurant Helper.
Enter the menu price for your meal: 100
Enter your tip percentage: 15 T
he price of the meal is: 100.00
I want to compare two strings and count the number of identical letters:
stringB = "ABCD"
stringA = "AABBCCDDEE"
for b in stringB:
if b in stringA:
r = 0
r += 1
print (r)
How do I count the output (r) instead of printing it out?
(result should be 4). Thanks!
__
Forwarding to list.
Please always use reply-All or Reply-list when responding to the list.
On Feb 18, 2017, at 6:21 PM, Alan Gauld via Tutor mailto:tutor@python.org>> wrote:
>
> On 18/02/17 21:52, Joseph Slater wrote:
>> I'm trying to use the scipy.optimize code ...
>> I've seen this done with di
On 25/02/17 17:12, Rafael Knuth wrote:
> I want to compare two strings and count the number of identical letters:
>
> stringB = "ABCD"
> stringA = "AABBCCDDEE"
> for b in stringB:
> if b in stringA:
> r = 0
> r += 1
> print (r)
>
> How do I count the output (r) instead
On 25/02/17 10:35, ehsan faraz wrote:
> ... where “tip” is an invalid syntax.
You need to assign a value to tip before trying
to read it, otherwise tip is undefined.
Similarly you should define price before trying
to use it.
But those would give you a NameError not a
syntax error... Can you sen
On Sat, Feb 25, 2017 at 02:35:21AM -0800, ehsan faraz wrote:
> Hello, I am working on the following assignment where “tip” is an
> invalid syntax. Can someone please tell me how to fix this? Here is
> what it should look like:
Hello, and welcome!
Why don't you show us the actual error message
On 25/02/17 17:24, Alan Gauld via Tutor wrote:
>> If you don't know that you need to optimize then your
>> time is usually better spent elsewhere. Dictionaries
>> are pretty fast in Python and I'd suggest you try
>> that first before shaving milliseconds in places
>> that may not be where you need
Alan Gauld via Tutor wrote:
> On 25/02/17 10:35, ehsan faraz wrote:
>> ... where “tip” is an invalid syntax.
Alan went one step ahead and addressed the logical errors, but the
SyntaxError is caused by missing closing parentheses:
>> price = int(input("Enter the menu price for your meal:")
>> ti
(Sorry for top-posting)
Hi, I recently ran into the same problem when I wanted to embed an interactive
Matplotlib choropleth in my Tkinter app. I solved it by creating a separate
class MyPlot for plot + toolbar (it inherited from Tkinter.Frame). MyPlot
internally uses the pack geometry manager
Thank you for reading this.
As an exercise, and for no other purpose, I'm trying to convert some C++
code that I put together 17 years ago. I'm very rusty and hours of
Internet searches have made me more confused that I was to start with.
The following works under Python2 but not under Python
10 matches
Mail list logo