Python Tutorial part2

Python Tutorial part2

Hi, welcome to the Python Tutorial part2. In this lesson I am going to teach you some basic Python’s elements( String, Boolean and Numbers for now!). before we start the lesson you should know the “print()” and Values in python.

String, number and Boolean

Firs thing that we learn in Python Tutorial part2 is String. String stand for a text in Python and you can create it by typing text between quotation marks. For instance, “Hello World” is a string, Now lets talk about numbers. Type |print(5)| and run it, the outcome will be 5 (I teach you the “print” in next header), just keep in mind that you do not need quotation marks for number (if you use quotation it would turn into string). Booleans are True and False things for instance we type |male = True| male is a value and True is Boolean in this example, you will learn values in next header.

Python Tutorial part2

Print and values

Firs thing that we learn in Python Tutorial part2 is “print” type |print(“Hello World”)| in your Pycharm or any program that you use for coding python. You can put numbers in between parentheses too! Whatever you put in the parentheses Python would show it when you run the program (look at the picture below).

Python Tutorial part2

Some useful tips:

print(len(“string”)) : shows you the length of the word or sentence.

print(“Hello\n World”) : \n creates new line.

print(“Hello\” World”) : quotation mark recognition.

print(int(“5”)) : to turn “5” (string) to the number.

Now lets learn the values, what is a value in Python? Value is representative of number, string(text), Boolean (true or false) etc… for example type, | b = “Hello world”| b in here is representative of “Hello World” or |male = True| in here male is value and it shows that the person is male, the opposite of that would be | male = False|(below picture). We can even use numbers | my_number = 345| and you can print it by calling the value | print(my_number)| or | print(male)|.

Python Tutorial part2

Share This Article on social media

Facebook
Twitter
LinkedIn

this blog is written by Erfan Samadi

 I hope you enjoyed! feel free to leave comment.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Scroll to Top