Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: SyntaxError: multiple statements found while compiling a single statement
Post: SyntaxError: multiple statements found while compi...

This code works on Codecademy, but when I use it in Python I get an error message: SyntaxError: multiple statements found while compiling a single statement Why doesn't this code work in Python? Here ...
DragonG General Coding Help 1 5,456 Nov-26-2018, 04:17 AM
    Thread: How to add numbers in a list
Post: RE: How to add numbers in a list

(Nov-14-2018, 01:09 PM)Larz60+ Wrote: >>> alist = [4, 7, 68, 3, 8] >>> sum(alist) 90 >>> Thanks for answering, how would I put this into my code?
DragonG General Coding Help 3 2,835 Nov-17-2018, 08:44 PM
    Thread: How to add numbers in a list
Post: How to add numbers in a list

I got this calculator that turns each letter in a word to its corresponding number in the alphabet. For example, if you enter the word "the", you get [20, 8, 5]. How can I make it so that the numbers ...
DragonG General Coding Help 3 2,835 Nov-14-2018, 06:05 AM
    Thread: Help with HTML and CSS
Post: Help with HTML and CSS

How can I move the Amethyst in bold to the left of the page? I tried using float: left but it didn't work. Here is my code. Thanks for the help! [html] <!DOCTYPE html> <html> <head>...
DragonG Bar 2 2,290 Nov-07-2018, 06:20 AM
    Thread: Can someone fix this simple code so it works?
Post: Can someone fix this simple code so it works?

I get a syntax error. Here is the code: gender = raw_input("Whats your gender") age = (int(raw_input("Whats your age")) if gender == female and age >= 18: print "good" else: print "bad"
DragonG General Coding Help 1 2,226 Nov-03-2018, 02:40 AM
    Thread: Help with pig latin translator
Post: Help with pig latin translator

How come this works: pyg = 'ay' original = raw_input('Enter a word:') if len(original) > 0 and original.isalpha(): word = original.lower() first = word[0] new_word = word + first + pyg ne...
DragonG General Coding Help 1 2,275 Nov-01-2018, 03:51 AM
    Thread: Difference between return and print
Post: RE: Difference between return and print

(Oct-25-2018, 02:17 AM)Larz60+ Wrote: Quote:I heard return can be used to save a value and use it again later, can someone show me how this is done using code a newbie can understand? In plain engli...
DragonG General Coding Help 9 6,577 Oct-25-2018, 03:51 AM
    Thread: Difference between return and print
Post: RE: Difference between return and print

I heard return can be used to save a value and use it again later, can someone show me how this is done using code a newbie can understand?
DragonG General Coding Help 9 6,577 Oct-24-2018, 10:57 PM
    Thread: Difference between return and print
Post: Difference between return and print

For this code, why can't you just replace return with print? What is the difference between return and print, explained so that a beginner can understand it? def greater_less_equal_5(answer): if ...
DragonG General Coding Help 9 6,577 Oct-24-2018, 05:56 PM
    Thread: Do I always have to use triple quotes or \n for multi-line statements?
Post: RE: Do I always have to use triple quotes or \n fo...

Thanks for answering. I was wondering, are there any multi-line statements that do not require the use of triple quotes or \n?
DragonG General Coding Help 3 2,624 Oct-24-2018, 04:17 AM
    Thread: Do I always have to use triple quotes or \n for multi-line statements?
Post: Do I always have to use triple quotes or \n for mu...

Which multi-line statements do not require me to use triple quotes or \n? I am new to Python. Thanks for answering.
DragonG General Coding Help 3 2,624 Oct-23-2018, 07:27 PM
    Thread: Help with simple tip calculator
Post: RE: Help with simple tip calculator

(Oct-23-2018, 01:32 AM)ichabod801 Wrote: Sorry missed the rounding question. You can round with the round function, as in round(price_meal, 2). However, I would use string formatting for this (%.2f ...
DragonG General Coding Help 5 5,394 Oct-23-2018, 02:57 AM
    Thread: Help with simple tip calculator
Post: Help with simple tip calculator

Can someone please fix my code for a simple tip calculator? I am new to Python. price_meal = raw_input("How much did your meal cost?") tip = raw_input("How much do you want to tip, in decimal form?") ...
DragonG General Coding Help 5 5,394 Oct-23-2018, 12:21 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020