How to make variables calculate from one another | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make variables calculate from one another

Hello guys, I would like to do this a code: Use two variables to calculate from each other. I did the below and it doesn’t work - can you please help? Number = 5 Tax = Number * 1.2 print(Number + Tax) print() I would like to have the number x 1.2 in the tax variable - can you do this?

27th Mar 2021, 8:19 PM
FA1
5 Answers
0
What's wrong you're getting there? Question is not clear to me..can you say more?
27th Mar 2021, 8:37 PM
Jayakrishna 🇮🇳
0
I ran it and it works just fine. The only thing you may want to do is only use lower case when making variables. First letter uppercase is used for classes.
27th Mar 2021, 8:38 PM
Slick
Slick - avatar
0
Slick can you help me with what a ‘class’ is please ? I think i was using a different version of python and it didnt work - thank you :)
27th Mar 2021, 8:58 PM
FA1
0
You only need Tax to be printed...! print(Tax) not Tax+Number
27th Mar 2021, 8:59 PM
Jayakrishna 🇮🇳
0
classes are more advanced python. you may have heard of OOP, and classes are part of it. You'll learn when you get to that lesson so not trying to overload you now
27th Mar 2021, 9:00 PM
Slick
Slick - avatar