Printing, Commenting and Numbers
I also learned how to write a comment on script by using:
# type comment here
This would leave what is written in the code without altering the code in any way. Doing this allows a programmer to leave messages for themselves or others
I learned how to use different mathematical symbols within code and what they do such as:
- this will subtract one number from the other
+ this will add the numbers together
* this will multiply the numbers together
/ this will divide one number from the other
< this will check if the first number is smaller than the second number
> this will check if the first number is greater than the second number
== this will check if the two numbers are equal
!= this will check if the two number are different
<= this will check if the first number is smaller than or equal to the second number
>= this will check if the first number is grater than or equal to the second number
I learned how to generate an output using the print command which would be written as such:
Input:
print("Hello World!")
Output:
Hello World!
or
Input:
print("I am 20 years old today!")
Output:
I am 20 years old today!
you can also print solutions to maths problems such as:
Input:
print(26-7*3)
Output:
5
or
Input:
print(30/3+5)
Output:
15
you can also compare two numbers to give a true or false answer such as:
Input:
Print(15<20)
Output:
True
or
Input:
print(22!=22)
Output:
False
or
Input:
print(15>=13)
Output:
True
or
Input:
print(12==24)
Output:
False
Programming blog (up2120129)
More posts
- Functions and ArgumentsDec 15, 2022
- LoopsDec 15, 2022
- ConditionsDec 15, 2022
Leave a comment
Log in with itch.io to leave a comment.