What is the index number of "tacos" in this list:*

foods = ["tacos", "burritos", "nachos"]
1
0
3
2

5 answers

The index number of "tacos" in this list is 0.
What is the index number of "steve" in this list:*
users = ["daniel", "jim", "steve"]
2
3
4
0
The index number of "steve" in this list is 2.
Write Python program which checks if a user is in the correct height range to ride a roller coaster. You should:*
- Create a function called `check_height()`
- It should take one parameter,`height`, which is a float
- In the `check_height()` function:
- If the `height` is less than 5.2 or more than 7.5, display: "You cannot ride the roller coaster".
- If the`height` is between 5.2 and 7.5 (inclusive), display: "You can ride the roller coaster".
- In the main area of your program:
- Prompt the user for their height and store their response in a variable.
- Don't forget to convert to the correct data type!
- Use the `check_height()` function with the user-provided height to see if they can ride the roller coaster.
Here's the Python program that checks if a user is in the correct height range to ride a roller coaster:

```python
def check_height(height):
if height < 5.2 or height > 7.5:
print("You cannot ride the roller coaster")
else:
print("You can ride the roller coaster")

# Prompt the user for their height
user_height = float(input("Enter your height: "))

# Check if the user can ride the roller coaster
check_height(user_height)
```

In this program, we define the `check_height()` function that takes a height parameter. Inside the function, we check if the height is less than 5.2 or greater than 7.5. If it is, we print "You cannot ride the roller coaster". Otherwise, we print "You can ride the roller coaster".

In the main area of the program, we prompt the user for their height and store their response in the `user_height` variable. We then call the `check_height()` function with the `user_height` to determine if the user can ride the roller coaster.