Python Notes | First Topic | Python Tutorial | Comment | AI Tool

 Programs

1. print("Hello World")
Output: Hello World
2. name="Prabhjot Singh"
id= 24321
print(name)
print(id) 
Output: Prabhjot Singh
24321
#If we wants to add together name and id then we can't add them because one is of string(words) format and other is of integer(number) format 
#we can add together if both are in string formats or both are in integers.
Examples:-

3. name="Amit"
father_name=" Ankit Kumar"
print(name+father_name)
Output: Amit Ankit Kumar
4. id="1234"
phone_number="9999999999"
print(id+phone_number)
Output: 1234 9999999999
if we wants to add numbers together then we have to add double quotes "" otherwise without double quotes sum of number will be printed i.e:-
5. first_id=12
second_id=13
print(first_id+second_id) #12+13=25
Output: 25

Programs to be used for AI tools

1. name=input("What is your name?")
print("Hello"+name)
Output: What is your name? Prabhjot Singh
Hello Prabhjot Singh
When we wants to take value from user then we have to add input function.
2. input("")
print("Hi! Prabhjot Singh is here")
Output: Hello 
Hi! Prabhjot Singh is here

Comment

Python comments are simple sentences that we use to make the code easier to understand. They explain your way of thinking and describe every step that you take to solve a coding problem. These sentences are not read by the Python interpreter when it executes the code. 

Comments in python basically starts from # (hashtag)

Example:- #Welcome to free online python course.

Post a Comment

Previous Post Next Post