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


Modify

In the modify tasks, students adapt the example code to start to create code of their own.

Make sure that the students add comments to explain what the code does.


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