TORONTO KIDS COMPUTER CLUB | Wednesday Friday 15:00 Python Practice 20.08.05.
18088
post-template-default,single,single-post,postid-18088,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Wednesday Friday 15:00 Python Practice 20.08.05.

06 Aug Wednesday Friday 15:00 Python Practice 20.08.05.

Question 1:

A soccer team is looking for girls from ages 10 to 12 to play on their team. Write a program to ask the user’s age and if male or female (using “m” or “f”). Display a message indicating whether the person is eligible to play on the team.

Sample Input 1:
Age: 10
Gender: f

Sample Output 1:
Welcome to the team!

Sample Input 2:
Age: 10
Gender: m

Sample Output 2:
You are not allowed to play!

Question 2:
Continue coding the program we did in the class, so the program will tell you whether you can pay in the zone:

height

color

zone

if<90

green

1

elif<105

yellow

1, 2

elif <115

red

2,3,4

elif <130

pink

3,4

elif <150

blue

4

else

white

4,5

Please continue coding the following program:

h = int(input('Height:'))
if h < 90:
    c = 'green'
elif h < 105:
    c = 'yellow'
elif h < 115:
    c = 'red'
elif h < 130:
    c = 'pink'
elif h < 150:
    c = 'blue'
else:
    c = 'white'

print('your color is', c)

z = int(input('Zone to play: '))
if z == 1 and (c == 'green' or c == 'yellow'):
    print('You can play in zone 1')
3 Comments
  • Ethan Li
    Posted at 12:58h, 07 August Reply

    h=int(input(‘Height: ‘))
    if h<90:
    c='green'
    elif h<105:
    c='yellow'
    elif h<115:
    c='red'
    elif h<130:
    c='pink'
    elif h= 10 and age <=12 and (gender== 'g' or gender == 'girl' or gender == 'female'):
    print('Welcome to the team')
    else:
    print( 'You are not allowed to play!')

  • Jesse Shi
    Posted at 17:25h, 07 August Reply

    age = input(‘age: ‘)
    if age == ’10’ or age == ’11’ or age == ’12’:
    print(‘OK? Is that so?’)
    else:
    print(‘To bad! Ha!’)
    Gender = input(‘Gender: ‘)
    if Gender == ‘f’ or Gender == ‘female’:
    print(‘Welcome to my stupid team, heehee…’)
    else:
    print(‘Sorry, please enter ctrl + alt + delet and prese enter to leave a messeage…’)

  • Jesse Shi
    Posted at 17:45h, 07 August Reply

    h = int(input(‘Height:’))
    if h < 90:
    c = 'green'
    elif h < 105:
    c = 'yellow'
    elif h < 115:
    c = 'red'
    elif h < 130:
    c = 'pink'
    elif h < 150:
    c = 'blue'
    else:
    c = 'white'

    print('your color is', c)

    z = int(input('Zone to play: '))
    if z == 1 and (c == 'green' or c == 'yellow'):
    print('You can play in zone 1')
    elif z == 2 and (c == 'yellow' or c == 'red'):
    print('You can play in zone 2')
    elif z == 3 and (c == 'red' or c == 'pink'):
    print('You can play in zone 3')
    elif z == 4 and (c == 'red' or c == 'pink' or c == 'blue' or c == 'white'):
    print('You can play in zone 4')
    elif z == 5 and (c == 'else'):
    print('You can play in zone 5')

Post A Comment