Thursday, October 29, 2015 7:09 PM

Python For Loops (Activity 4.1.2)

Python
Question:
Write an if-else statement for the following:
If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets to num_tickets.
Ex: if user_tickets is 3, then num_tickets = 1. 

Code:
user_tickets = 0

if user_tickets<5:
    num_tickets=1
else:
    num_tickets=user_tickets

About Unknown

Here you can share some biographical information next to your profile photo. Let your readers know your interests and accomplishments.

1 comment: