Learning python - 2nd day (Morning)

 Watching tutorial: https://www.youtube.com/watch?v=DWgzHbglNIo&list=PLsyeobzWxl7poL9JTVyndKe62ieoN-MZ3&index=4 


Learned about (+,-,*,/)

Wait, the / gives an output with decimal values after point. Lets see how to fix it

Using // to get an integer output instead of float.

Learned about (print(String))

We can use both " " and ' ' in order to print a String.

If I want to print " " in print(String) function, I need to use backslash (\) to make python ignore the next case.

If I want to print "\" I need to tell python that I want just a simple print, no special functions. Which can be done by using (r) before the String.

For example: print(r"Hello \new world")

Output:

 Hello \new world

Output without ( r ): 

Hello

ew world


Also I can now use (**) the double multiplication sign to make (power of) function.

Example: 2*3 = 6  but 2**3 = 8  (Similar to 2^3=8 in general)


Well, the most exciting function I learnt is printing a specific String as many times as I want to. 

The function is simple. 

Input: 

print(10*"Shad") 

Output: 

ShadShadShadShadShadShadShadShadShadShad

Isn't this fun? Well I have only finished 1 tutorial today. I will start doing the 2nd tutorial at noon! 

Comments

Popular posts from this blog

Apple iPad Air (2022) Specifications and Review in 2023

17-year-old suspect in fatal stabbing at Taylor Swift-themed dance event ID’d

Exercise vs Diet