#PRINTING SOMETHING:- (SENTENCES OR WORDS)
AFTER WRITING print - {AS PYTHON IS CASE SENSITIVE SO WE HAVE TO WRITE PRINT AS- print NOT IN CAPITAL LETTERS } AND PUTTING BRACKETS () IN THIS BRACKETS WHATEVER WE HAVE TO WRITE AS A OUTPUT IF IT'S A STRING WE WILL WRITE IT IN QUOTES I.E (" ") ( ' ') .
👆HERE I HAVE USED (**) FOR DESIGNING INSTEAD OF THIS U CAN USE ANYOTHER TO MAKE IT MORE ATTRACTIVE .
👆HERE YOU CAN 👀ANALYSE IN THE OUTPUT THAT WHATEVER WE HAD WRITTEN ABOVE IN THE BRACKETS IN QUOTES IT IS NOW SHOWN IN THE OUTPUT.
TRY IT YOUSELF !! : -
print("***************************************") print("HELLO EVERYONE FOLLOW MY BLOG!!!") print("***************************************")
# NOW WE WILL PERFORM SOME SIMPLE MATHEMATICAL OPERATIONS:-(ADDITION , MULTIPLICATION , )
1) ADDITION : -
👆HERE I WILL EXPLAIN U THE CODE LINE BY LINE:
1ST LINE AND 4TH LINE= ("**************)👈THIS IS USED AS DESIGNING. (OPTIONAL TO WRITE)
2ND LINE=("IF WE WILL ADD...)👈THIS WILL PRINT AS A SENTENCE TO KNOW WHAT WILL BE THE OUTPUT ABOUT.(OPTIONAL TO WRITE)
3RD LINE=(5+3)👈HERE I HAVE NOT USED QUOTES (" ") BECAUSE I DONT WANT IT AS IT TO BE PRINTED AS IT IS WRITTEN THEREFORE I HAVE WRITTEN IT WITHOUT QUOTES .
👆HERE WHATAVER I HAVE WRIITEN IN QUOTES IS PRINTED EXCEPT (5+3) AS IT BECAUSE I HAVENT PUT QUOTES BEFORE AND AFTER THEM. SO PYTHON HAS PERFORMED THE OPERATION OF ADDITION. I. E 5+3=8.
TRY IT YOUSELF !! : -
print("**********************************")
print("IF WE WILL ADD 5 AND 3 WE WILL GET:")
print(5+3)
print("**********************************")
# IF HAD WRITTEN (5+3) IN QUOTES LIKE= ("5+3")
THEN THE CODE AND THE OUTPUT WILL BE:
I HOPE NOW U HAVE UNDERSTOOD THE DIFFRENCE OF WRITING SOMETHING IN QUOTES (" ")(' ') AND WRITING IT WITHOUT QUOTES ( ).
TRY IT YOUSELF !! : -
print("***")
print("5+3")
print("***")
2) MULTIPLICATION : -
IT IS ALL SAME AS THE ADDITION PROGRAM THE ONLY DIFFRENCE IS OF THE SIGN THAT IS (*) USED FOR MULTIPLICATION .
👆HERE IT HAS PERFORM THE OPERATION OF MULTIPLICATION U CAN 👀ANALYSE IT FROM THE 3RD LINE OF CODE.
TRY IT YOURSELF !! : -
print("**********************************")print("IF WE WILL MULTIPLY 5 AND 3 WE WILL GET:")
print(5*3)
print("**********************************")
TRY DIVISION AND SUBTRACTION ON YOUR OWN IT IS THE SAME AS ABOVE PERFORMED OPERATIONS THE ONLY DIFFRENCE WILL BE OF THE SIGN
No comments:
Post a Comment