Hello everyone! My name is Amena.👋
Python is an Interpreted, Object Oriented High level programming language that uses Dynamic Semantics and it's so easy to use python!! In late 1980's Guido Van Rossum had Invented Python Language!! When Guido Van Rossum was making this language he saw a "Monty Python Circus" named show, and he decided to name this language "Python". He named this language as Python because he want a unique and short name. Till 12th of July, 2018 he had taken a responsibility. As a lead Developer it is so appreciable and hard-work!🌎 But after 2018 Guido Van Rossum had to announce his permanent vacation, Genuinely he was the legend!♥
After the long journey, python is one of the most preferred language. In the 1990s, the development of the Python language was done in very spectacular. And in the year 2000 Python 2 was released, after this in the year 2008 Python 3 was released.🐍
Along with Python 3, a utility called "2to3" has been released that will help you convert your Python 2 code to Python 3. Even after the popularity of python many people use python 2.7, because they were more comfortable with the syntax of python 2.7. Also in python 3 there were so many changes compared with python 2.7. The end of python 2.7 was announced in 2015, means it was compulsory to use python 3 only.🗨
So this was history about python now let's come to the language and syntax!!😀
So now let's go!!🗨
- For commenting(It'll not output anything!) any string hashtag (
#) is used, LIKE THIS👇
#This is a comment.
- In python there is a function called
- In python you can you use arithmetic operators(+, -, /, *) LIKE THIS👇
print(6 + 6) print(6 - 6) print(6 / 6) print(6 * 6)
- To declare variables you can simply type variable = value. LIKE THIS👇
variable = "Hello" amena = 1
- To store one or more values you can use
listwith square brackets (
These were something about python syntax👆
mylist = ["Burger", "Pizza", "Sandwich", "Hotdog"] amena_likes = ["Badminton", "Cricket", "Football"]
Now let's come to the If, else and elif statements in python🗨
So, I am here because of If,else and elif statements in Python and I will try my 100% to teach you all. And also personally if, else and elif statements my favorite.
So Let's Start First let's talk about if statements in Python!!
Basically if statements are like: IF YOU'LL GIVE ME 10 BUCKS THEN I'LL GIVE YOU CHOCOLATES.
Okay hopefully that went well!! So lemme give you some examples of if statements!!
money = int(input("For chocolates pay 10 bucks, Pay here: " )) if money == 10: print("Chocolates are yours🍫🍫🍫")
For chocolates pay 10 bucks, Pay here: 10 Chocolates are yours🍫🍫🍫
So there is one thing that you must know in python, that from colon
(:) and then space (indentation), Python understands that we are inside of the
if block. And hence it executes what is inside
if, if the condition provided is true.
So hopefully you are done by if statements, and you have cracked one of the statements!!😉 Congrats!!🥳
So now lets come to else statements in Python!
Now for those who are beginners, they would be wondering that what are else statements?🤷
So let's go!😎
Lemme give you one example for else statements!!
money = int(input("For Fries pay 3 bucks, Pay here: ")) if money >= 3: print("Fries are yours!🍟") else: print("Not enough money.")
For Fries pay 3 bucks, Pay here: 3 Fries are yours!🍟
But if anyone is not having enough money👇
For Fries pay 3 bucks, Pay here: 2 Not enough money.
Basically It's a rule in python that there should not be any kind of condition after else statements like we must write colon after else statements!! Like this:
So, Hopefully you are done with else statements also!! Wow! It's Dope!!👏👏
Let's move on to the next one that is elif statements.😉
Basically elif statements are the mixture of else + if = elif.
food = input("ice cream or pastry: ") if food.lower() == "ice cream": print("🍦") elif food.lower() == "pastry": print("🍰") elif food.lower() == "ice cream and pastry": print("🍦🍰")
So these were the If, else and elif statements👆
Now I am gonna recommend some channels to you guys for learning coding!!👩💻👨💻
Code with Harry.(IN hindi)
Max programming (My brother's channel...)
Code Arena (My channel)