Summary

In this lab, we covered several major important topics. Let’s quickly review them.

Pseudocode Input

  • INPUT() will read input from the user and return what was typed as a string value.
  • INPUT() is terminated by the user pressing ENTER, so next output starts on a new line.

Pseudocode String Operators

  • + Concatenation (join strings together). May only be applied to two strings.

Returning Data from Procedures

  • RETURN(expression) will return the value of expression to where the procedure was called from.
  • Procedure calls can be used in assignment statements to store return values, or as part of other expressions.

Python input

  • input(expression) will display the expression to the user as a prompt, then return what was typed by the user as a string value.
  • input(expression) is terminated by the user pressing ENTER, so next output starts on a new line.

Python String Operators

  • + Concatenation (join strings together). May only be applied to two strings.
  • string.format(value1, value2) performs string formatting. The string portion is any valid template string, which contains curly braces {} as placeholders. Each placeholder will be replaced by the matching argument value1, value2, etc. from the format() method.

Returning Data from Functions

  • return expression will return the value of expression to where the function was called from.
  • Function calls can be used in assignment statements to store return values, or as part of other expressions.

Complex statements

Expressions can be combined in many ways within a statement. Expressions can be used as arguments to procedures, and more!