Search This Blog

Day 03: Python Learning with Angela Yu

Hey, I've decided to stick with Angela Yu's #100DaysofPython challenge. The course started with a warm welcome along with all the useful resources to stay motivated and always up with consistency. Since in success, each day step taken is more important.

So, therefore, took the pledge to continue this journey (staying consistent) no matter what & also marked my day 1 completion in the below image:

 This is Day 01 and here are my all the learnings:

1.  String Manipulation and code intelligence is the very first learning in python. 

a. The String Concatenation is done with the "+" sign.

    e.g. print("Hello " + "world")

b.  Be careful while writing code. There can be syntax errors if you make spelling mistakes, can be             indentation errors if 4 space indentation is not followed in Python.

     Luckily, now we have smart text editors which, do this job on our part and when you do any                 mistake it alerts "red vertical line".

Note: New lines can be created with a backslash and n. e.g: print('Hello\nWorld')

Output:

Hello

World

2. Input function is used to take inputs from a user. Once we hit run it prompts the user to input something.

Syntax:

input("Enter your name:")

e.g:

print("Hello" + " " + input("Enter your name:")")

output:

Enter your name: Kawal Preet Kaur

Hello Kawal Preet Kaur


Note: You can also calculate the no. of characters in your input using the len function.

Syntax:

user_input=input()
print(len(user_input))

#or

print(len(input())

Further, covered variable nomenclature which I had read in UNI time already.
All are somewhat similar to other programming languages.

In the end, the day ended with a project: band name generator which I
modified to generate a youtube channel name generator:


Thank You & See you again with the next day update!

No comments:

Post a Comment