163k views
4 votes
Python Variables Worksheet

Print | Save
Output: Your Goal
You will write a program to store a message in two variables, then print that message.

Part 1: Plan and Write the Pseudocode
Write an algorithm using pseudocode that someone else can follow. Choose one of the following options:
Decide on the message you would like to display to the screen. Some ideas include:
Your favorite book title or TV show and why you like it
A few sentences sharing information about you
Your favorite sport and team or athlete
Use two variables to store your message.
Insert your pseudocode here:






Part 2: Code the Program
Use the following guidelines to code your program.
Use the Python IDLE to write your program.
Using comments, type a heading that includes your name, today’s date, and a short description.
Set up your def main(): statement. (Don’t forget the parentheses and colon.)
Use at least two variables and two print statements to display your message to the screen.
Conclude the program with the main() statement.
Follow the Python style conventions regarding indentation in your program.
Run your program to ensure it is working properly. Fix any errors you may observe.
Example of expected output: The output below is an example of a “Favorite TV Show” message. Your specific results will vary depending on the choices you make about your message.
Output
My favorite TV show is MythBusters.
I like it because I learn a lot and they do crazy experiments.

When you've completed writing your program code, save your work by selecting 'Save' in the Python IDLE. When you submit your assignment, you will attach this Python file separately.

Part 3: Post Mortem Review (PMR)
Write two to three sentence responses to all the questions in the PMR chart.
Review Question
Response
What was the purpose of your program?

How could your program be useful in the real world?

What is a problem you ran into, and how did you fix it?

Describe one thing you would do differently the next time you write a program.



Part 4: Save Your Work
Don't forget to save this worksheet. You will submit it for your assessment.
Print | Save

1 Answer

1 vote

Answer:

Pseudocode:

define func main

accept two parameters

create two variables from those parameters

v1 = title

v2=message

print v1, v2

returns None

call the func including the two arguments

Code:

def main(p1, p2):

""" this is a docstring, the function accepts two parameters p1 and p2 and prints them out"""

____title = p1

____message = p2

____print(title)

____print(message)

main()

Reminder

this didnot include the comment you are to add about your name, date and details

-- comments are placed after a pound sign (#)

also "____" the dashes behind the variables are not indentation just empasising them, as they are done with either by

  • Tab Button - pressed once
  • Space Bar - pressed four times

NEVER MIX THEM CHOOSE AN INDENTATION STYLE AND STICK TO IT

Finally the call function doesn't have a colon called as a nomal object, just as the print funtion also you may include the dicstring if neccessary.

DONT FORGET THE REVIEW QUESTIONS

User Whoisearth
by
5.6k points