My first coding assignment in Python

I am having major issues with a simple assignment for school. I need to know what is wrong with this code.
Error: File “/home/runner/work/9780357880876_pld-10e-python-145ba7d2-9f0b-4116-afd3-3be7dea0c8ae/9780357880876_pld-10e-python-145ba7d2-9f0b-4116-afd3-3be7dea0c8ae/Programming.py”, line 1
$ python /workspaces/9780357880876-pld-10e-python-145ba7d2-9f0b-4116-afd3-3be7dea0c8ae/chapter1/ex01/student/Programming.py
^
SyntaxError: invalid decimal literal

Timestamp: 2024-03-23 21:23:35.469897

Task 2: Modify the Python program so it prints two lines of output. Add a second output statement that displays That’s awesome!. Execute the program.

An example of the program is shown below:

I’m learning how to program in Python.
That’s awesome!

I tried to refresh in order to obtain the original task in the terminal area, but it didn’t work for me

Open the file in your editor or IDE and look at line 1 of the file.
Is it valid python code?

My guess is that /home/runner/work/9780357880876_pld-10e-python-145ba7d2-9f0b-4116-afd3-3be7dea0c8ae/9780357880876_pld-10e-python-145ba7d2-9f0b-4116-afd3-3be7dea0c8ae/Programming.py
contains the text

$ python /workspaces/9780357880876-pld-10e-python-145ba7d2-9f0b-4116-afd3-3be7dea0c8ae/chapter1/ex01/student/Programming.py

If so then that looks like the start of a tutorial and not the python code itself.

When pasting code and output here use the </> button that will include the text as pre-formmmated text like this:

```
print('Hello world')
```

Please start by reading the pinned thread in order to understand how to make code show up with proper formatting. It’s important to view the code with a monospace font and the proper indentation. The forum software doesn’t know it’s code unless you mark it up, and the result can’t be properly read or understood.

Next, make sure to use complete English sentences in order to explain clearly what steps you take in order to try creating and running the program. We need to be able to understand what parts are code that you typed; what parts are your understanding of the actions you’re taking; what parts are what the assignment says; and what parts are things that you see on the screen (aside from what you actually typed).

It’s especially important to understand the environment that you used to try to write the code. For example, did you open a text editor and start writing code in a new file? Did you use the interactive Python prompt (by running python in a command window)? Are you using an IDE (a program for editing code - such as IDLE, which comes with Python, or PyCharm, or VSCode, or Spyder, etc.? Which one?)? Something else?

thank you!

thank you so much!


So, my first task was a success and I need to add the second sentence. I thought I could just add a second print line, but that didn’t work. I’m not sure what kind of changes are needed for a second sentence. they want a change in the program. Any and all suggestions are welcome.

Well, first and foremost thing: never, ever post screenshots of your program. If you are asking about your program, please post the program, not an image of it.

I may sound harsh, but doing this you are violating the Netiquette: an unwritten set of rules that is kind of consensus between people on how to live in the Internet and more specifically among people who do programming. It may not look like a big deal, but posting screenshots drastically lowers down the amount of people that are willing to help you with your task :frowning:

Also, when we are at posting your program: you have also do it in a specific way. Unfortunately the way of how this forum software works requires from you to post it this way:

Place your code between → ``` ← these three backticks (If you can’t find them on your keyboard, just copy them from my post). The backticks must appear alone in a line above and below your code. Like this way:

```
#your code goes there
```
which will result in rendering your code like this:

#your code goes there

This is especially important as (you may not know it yet) in Python indentation serves as a part of Python’s grammar so it is crucial for your code to include them. If you post your code without these backticks the software of this forum will mangle your code making it to us as much unusable as if you were post the screenshot again.


I hope I made myself clear. I know it is hard at first, but this is the “red pill” everyone have to swallow before others can help you for real. :smiley:

@FelixLeg Do you find the pinned topic about formatting lacking? Maybe suggest an improvement then.

Your code looks ok to me in the screenshot. (Though we would normally
put each print() on its own line. Not required, just conventional.)

Maybe your error in the right half of the screen is out of date? Do you
need to press some “Run code” button?

But the real test for us is running it, and for that the easiest thing
is if the code is in your post as text, not as a screenshot.

Please show your code inline as text between code fences. There’s a
</> button in the compose bar for making these. Copy/paste the text
of the code into that section. The same for error messages.

Cheers,
Cameron Simpson cs@cskk.id.au