replit

Before you start this course, you must login to Replit

If you have forgotten your Replit account user name or password, ask your Coder Coach.

CoderSports


Predict & Run

At the ‘predict’ & ‘run’ stages students work entirely with example code. They should inspect it carefully and write a prediction about what it will do.

They then run the code and compare the result to their prediction.


Changing Case

Convert all characters to CAPS

string.upper()

Convert all characters to lower case

string.lower()

These two functions are useful to get Python to ignore case. When getting a user input, use either the upper() or lower() method to convert that string to uppercase or lowercase. Then compare it to an either upper or lower case string.

This is an example use case where case does not matter.

print("What's the best school subject?")
answer = input()
answer = answer.upper()

# Now the user input is all uppercase and can be easily compared to the next line.

if answer == "COMPUTER SCIENCE":
  print("You betcha!")
else:
  print("I think you made a mistake, it's spelled 'Computer Science'")

Help! My Code Does Not Work!

Make sure to check your code for the following things:

  • .upper() or .lower() are immediately after the string or variable with no space between.
  • .upper() or .lower() have the . before and brackets after.

Hints