Club100 | Learn Python With Steem - Lesson 2 | datatype, variables, basic syntax and exercise questions - Learn and earn steem

in #learnwithsteem2 years ago (edited)

Hello everyone! It's me again vvarishayy, hope you are well. A few days back I posted a lecture 1 on python this is lesson 2 on python which would be about; datatype, variables, and some basic syntax. And last but not least the exercise questions would help you to practice python. If you solve those questions and show them to me in comments or make a post on it, I will give you some steem in return as a reward for your commitment. Don't forget to share with your friends.

I am making it quite easy, keeping in mind that I am teaching people who don't know any computer language, so if you are new to programming you can also take part. Before reading this post, I advise you to read lecture 1.

Lecture # 1LINK

COMMENTS
Comments are # that we use in python for documentation of the code. It is quite easy for the programmer to understand its code after a while or other programmers can also understand it easily. While the program without comments becomes a bit difficult to understand if you are reading the huge code.

image.png

#my name is warisha. I love steemit <3 is a comment that is not showing me errors on shell

VARIABLE

We can't define the things directly while coding we have to assign the variables that can be any letter but not number or characters. The variable must be understandable for ease.

Note: In python, variables are case-sensitive.

image.png

num is a variable

DATATYPE

datatypedescription
Numericintegers(numbers), float (decimal numbers)
Stringtext
Boolean TypeTrue or False

TYPE FUNCTION

In python there is a built-in function called type function, that tells us the data type of the given data.

image.png

BUILT-IN

Builtin are predefine in python. We must not use them while assigning the variables, in function, or using it explicitly in the code.

image.png

INDENTATION

Indentation is the gap we use in python. At this time you may not know about the things, I am teaching to a complete beginner, and if you know what it is then well and good. I will explain you with the help of the program. You can see below, forget about the logic and the things you are not getting but see whenever I put a : colon, on the next line I gave a space of 4 then wrote something. This 4 letter space is called indentation.

image.png

QUOTATIONS: The words, numbers, and characters in the quotations are string data types.
'/n': Used to continue on the next line.
==: equal to sign
!=: not equal to sign

EXCERCISE

Do the exercises questions and show them to me and I will give you some steem as a reward <3

These questions were given to me by my teacher and I am giving them to you, to solve because coding is a practice game. If you practice it, you will become a pro.

image.png

image.png

image.png

image.png

Note: for question 1, no iteration is needed because I haven't taught that yet, only made that with the help of a print statement. You can leave 1 question in choice. I will give the answers to the questions in my next post.

Thank you for reading future programmers,

With kind regards
Pythonista
vvarishayy

Sort:  

Thank you for contributing to #LearnWithSteem theme. This post has been upvoted by @zmoreno using @steemcurator09 account. We encourage you to keep publishing quality and original content in the Steemit ecosystem to earn support for your content.

Club Status: #Club100

Sevengers Comment GIF.gif

Regards,
Team #Sevengers

Thank you sevengers <3

BUILTIN
Builtin is the functions that are predefined by the python.

The words listed in the table are not functions, but reserved statements.

I don't want to be rude, but to solve the tasks, you would have to explain a little more. The tasks seem to be more extensive than your lesson.
For example, an absolute beginner knows nothing about the boolean-value of -16 to solve task 10. You also haven't explained the operator precedence to solve some tasks ...

Yeah you're right they're not functions, I've corrected it, I haven't discussed the functions right now.

Hmm it's the way of learning. I've given an option to leave one question, and I'll be giving the solutions in the next posts with details. Neither to solve thes questions are obligatory to someone but for better understanding.

I know already which questions people would feel difficult to solve and if someone try they will become curious for the solutions.

We all have different ways of teaching, and as far as operator precedence is concern my teachers gave this task in class by not defining all most of the people did it by simple logic. (We were in first year)

I don't know but I defined all the things that are crucial for the task but the task is not that easy and I'll be providing solutions with details.

Thank you for leaving your comment. I liked you reviewed it.

Congratulations, your post has been upvoted by @scilwa, which is a curating account for @R2cornell's Discord Community. We can also be found on our hive community & peakd as well as on my Discord Server

Manually curated by @abiga554
r2cornell_curation_banner.png

Felicitaciones, su publication ha sido votado por @scilwa. También puedo ser encontrado en nuestra comunidad de colmena y Peakd así como en mi servidor de discordia

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.032
BTC 63867.81
ETH 3135.89
USDT 1.00
SBD 3.84