Skip to content

Latest commit

 

History

History
65 lines (41 loc) · 2.21 KB

File metadata and controls

65 lines (41 loc) · 2.21 KB

Exercise 1: Strings & Variables

  1. Create a variable called name and assign your first name to that variable.
  2. Print "Welcome to the Dungeon, xxx!". Use name inside of your printing. Do not forget about f at the beginning You can use double or single quotes. Both will work!

Note: xxx has to be replaced by your name! Do not forget the space behind Dungeon,.

Expected Output:

If your name is Jane, then the output will look like this:

"Welcome to the Dungeon, Jane!"

Exercise 2: Boolean & Comparisons

This is the way how you write comments in Python:

# Hi! I'm Anna and I am living in coding.py.
# I'm an expert Python coder.
# I'm 51 years old and and I can teach myself Python.

Comments are useful for additional explanation of your code.

Instructions

1. Someone has introduced themselves to you using comments in coding.py. (It is just a joke, you do not have to create a file coding.py, of course ;) )

Read the comments and then create a variable called age_is_7 and set it to be True or False depending on if this person's age is 7.

2. Create a variable called name_is_anna and set it to be True or False depending on if this person's name is Anna.

Of course, you can create more variables with True or False. If you want, you can compare them with and, or, !=, ==.

Exercise 3: Conditions

Imagine that you are a teacher in school and you would like to automatize the calculation of grades.

Instructions

  1. Create a new variable student_points and give it a number between 100 and 0.
  2. Write first if condition that will say student_points > 90. If the condition is True, this will print A.
  3. The second condition will start with the new word elif (= else if). This condition will say student_points >= 80. If the condition is True, this will print B. Ask coaches for a help.
  4. And write else condition at the end that will print C.

Note: do not forget the 4 spaces after semicolon :, otherwise you will get IndentationError.

Output

Example: The student Nicole got 82 point in the school test.

You can expect this result:

B

Note: there can be more grades, of course ;)