Jump to content

Help with Python programming (Learner)

Go to solution Solved by Glenwing,

Well, figure out how many years they have left based on what grade they are in. 10th grade, 2 more years. 8th grade, 4 more years. You graduate at grade 12, so the years-left is your distance from 12. So, 12 minus current grade. Then add that to the current year.

print('You will finish in', (b + (12 - a)))

Hey guys so I am learning python at school and it wants me to do this 

 

Which grade are you in? 10
What year is it? 2015
You will finish school in...
2017
 
I know I have to do 
a = int(input('Which grade are you in? '))
b = int(input('What year is it ? '))

print('You will finish school in ',

 

but am not sure how to do the calculating?

Link to comment
https://linustechtips.com/topic/426518-help-with-python-programming-learner/
Share on other sites

Link to post
Share on other sites

Well, figure out how many years they have left based on what grade they are in. 10th grade, 2 more years. 8th grade, 4 more years. You graduate at grade 12, so the years-left is your distance from 12. So, 12 minus current grade. Then add that to the current year.

print('You will finish in', (b + (12 - a)))

Link to post
Share on other sites

Well, figure out how many years they have left based on what grade they are in. 10th grade, 2 more years. 8th grade, 4 more years. You graduate at grade 12, so the years-left is your distance from 12. So, 12 minus current grade. Then add that to the current year.

print('You will finish in', (b + (12 - a)))

Thanks!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×