Day-01 of learning python

I learned some basic stuffs in python programming language LIKE::: 1.airthmetic operators: python x=10 x=x+3 x +=3 2.comparison process in this language: # x=3!=2 # print(x) # > # >= # < # 20: print("not hot") 5.lists : We can say that list is mutability which means that we can insert the element even after the creation at first. taking example : There are three basic types from which we can define properly that what exactly is list and its use::: 1.insert() : we can insert any data or element in the square bracket : # Insert fruits.insert(1, "banana") print(fruits) # Output: ['apple', 'banana', 'blueberry', 'cherry', 'date'] 2.Append (): this helps to insert the data at the last of the list : # Append fruits.append("date") print(fruits) # Output: ['apple', 'blueberry', 'cherry', 'date'] 3.Extend(): This helps to Extend the list taking an example:: # Extend more_fruits = ["elderberry", "fig"] fruits.extend(more_fruits) print(fruits) # Output: ['apple', 'banana', 'blueberry', 'cherry', 'date', 'elderberry', 'fig'] for mutual extend example we see that: list1 = [1, 2, 3] list2 = [4, 5, 6] list1.extend(list2) print(list1) # Output: [1, 2, 3, 4, 5, 6] from above example we see that list1 just got extended because of addition of list2 6.Logical operator: # price = 25 # print( not price > 10 ) # and(both) # or(atleast1) 7.Receiving inputs :: name = input("What is your name?") print("Hello " + name) 8.strings sentence=("kops the great") print(sentence.replace('the','is')) print(sentence.find('the')) print(sentence.upper()) print(sentence.lower()) print(sentence.casefold) print(sentence.endswith('true bitch')) print('python' in sentence) print('the' in sentence) Kind of range and function:: numbers=[1,2,3,4,5,6] # numbers.clear() print(10 in numbers) 10.Type conversion(Most important) # birth_year= input("Enter your data of birth:") # age = 2020 - int(birth_year) # print(age) num1=input("FIRST NUM:") num2=input("SECOND NUM:") sum= float(num1)+float(num2) input("Sum is : " + str(sum)) It helps a lot in large program so it is most necessary to understand about These concept . 11.Variable(Kind of a container where different types of data are stored) :: patient_name="jhon smith" age ="20" patient_type="New patient" print("patient name is :",patient_name) print( "age is :",age) print("patient is:", patient_type) Here patient _name ,age, patient_type is a variables:: Question times:: 1.Suppose you were given a number either in kg or pound. If it is kg the convert it to pound and vice versa. And print the statement in proper format Incase you are having a problem on this the check it out pls>> weig = float(input("Weigth:")) conversion= input("kg or lbs") if conversion == "kg": result=weig/0.45 print("The weight in lbs is:" + str(result)) else : result = weig*0.45 print("The weight in kg is :" + str(result)) NOTE :: OUTPUT ARE NOT GIVEN ABOVE SO YOU HAVE LOOK FOR THIS YOURSELF IN ANY COMPILER . THANK YOU AND THAT”S FOR THE DAY 1.

Feb 19, 2025 - 18:55
 0
Day-01 of learning python

I learned some basic stuffs in python programming language

LIKE:::

1.airthmetic operators:


python
x=10
x=x+3
x +=3

2.comparison process in this language:

# x=3!=2
# print(x)
# >
# >=
# <
# <=
# ==
# !=

3.for loops:

numbers=[1,2,3,4,5,6]
# print(numbers)
for item in numbers:
    print(item)

i=0
while i<len(numbers):
  print(numbers[i])
  i=i+1

4.if statement :



temp = 25


if temp > 30:
    print("It's hot bebe")
elif temp > 20:
    print("not hot")

5.lists :

We can say that list is mutability which means that we can insert the element even after the creation at first.

taking example :

There are three basic types from which we can define properly that what exactly is list and its use:::

1.insert() : we can insert any data or element in the square bracket :

# Insert

fruits.insert(1, "banana")
print(fruits)  # Output: ['apple', 'banana', 'blueberry', 'cherry', 'date']

2.Append (): this helps to insert the data at the last of the list :

# Append
fruits.append("date")
print(fruits)  # Output: ['apple', 'blueberry', 'cherry', 'date']

3.Extend(): This helps to Extend the list

taking an example::

# Extend
more_fruits = ["elderberry", "fig"]
fruits.extend(more_fruits)
print(fruits)  # Output: ['apple', 'banana', 'blueberry', 'cherry', 'date', 'elderberry', 'fig']

for mutual extend example we see that:

list1 = [1, 2, 3]
list2 = [4, 5, 6]

list1.extend(list2)
print(list1)  # Output: [1, 2, 3, 4, 5, 6]

from above example we see that list1 just got extended because of addition of list2

6.Logical operator:

# price = 25
# print( not price > 10 )
# and(both)
# or(atleast1)

7.Receiving inputs ::

name = input("What is your name?")
print("Hello "  + name)

8.strings

sentence=("kops the great")
print(sentence.replace('the','is'))

print(sentence.find('the'))
print(sentence.upper())
print(sentence.lower())
print(sentence.casefold)
print(sentence.endswith('true bitch'))
print('python' in sentence)
print('the' in sentence)
  1. Kind of range and function::
numbers=[1,2,3,4,5,6]
# numbers.clear()
print(10 in numbers)

10.Type conversion(Most important)

# birth_year= input("Enter your data of birth:")

# age = 2020 - int(birth_year)
# print(age)    

num1=input("FIRST NUM:")
num2=input("SECOND NUM:")
sum= float(num1)+float(num2)
input("Sum is : " + str(sum))

It helps a lot in large program so it is most necessary to understand about These concept .

11.Variable(Kind of a container where different types of data are stored) ::


patient_name="jhon smith"
age ="20"
patient_type="New patient"
print("patient name is :",patient_name)
print( "age is :",age)
print("patient is:", patient_type)

Here patient _name ,age, patient_type is a variables::

Question times::

1.Suppose you were given a number either in kg or pound. If it is kg the convert it to pound and vice versa.

And print the statement in proper format

Incase you are having a problem on this the check it out pls>>

weig = float(input("Weigth:"))
conversion= input("kg or lbs")

if conversion == "kg":
     result=weig/0.45
     print("The weight in lbs is:" + str(result))
else :
    result = weig*0.45
    print("The weight in kg is :" + str(result))

NOTE :: OUTPUT ARE NOT GIVEN ABOVE SO YOU HAVE LOOK FOR THIS YOURSELF IN ANY COMPILER .

THANK YOU AND THAT”S FOR THE DAY 1.