#1 This is Your first Python Code
print("Hello")๐12โค1
#2 Creating variables
var = 5 # Here_var_is_variable
# It_has_stored_value_5
print (var) # Showing_var_value
var = 5 # Here_var_is_variable
# It_has_stored_value_5
print (var) # Showing_var_value
๐16๐3
#3 Creating variables & Adding
var1 = 5 # Variable 1
var2 = 7 # Variable 2
print (var1, '+', var2, '=', var1 + var2)
# Showing Add Result
var1 = 5 # Variable 1
var2 = 7 # Variable 2
print (var1, '+', var2, '=', var1 + var2)
# Showing Add Result
#5 Arrays[Basically List] in Python
arr = [2, 3, 5] # initialized Array
print(arr[0] ) # printing 1st element
print(arr[1] ) # printing 2nd element
arr = [2, 3, 5] # initialized Array
print(arr[0] ) # printing 1st element
print(arr[1] ) # printing 2nd element
๐5
in Python array doesn't exists but
You can import its functionality by
Writing this ๐
import array
And use array like this format ๐
variable_name = array(typecode,[elements])
You can import its functionality by
Writing this ๐
import array
And use array like this format ๐
variable_name = array(typecode,[elements])
#6 Arrays in Python (virtual)
import array as arr
numbers = arr.array('i',[10,20,30])
print(numbers[0]) # gets the 1st element
print(numbers[1]) # gets the 2nd element
print(numbers[2]) # gets the 3rd element
#output
#10
#20
#30
import array as arr
numbers = arr.array('i',[10,20,30])
print(numbers[0]) # gets the 1st element
print(numbers[1]) # gets the 2nd element
print(numbers[2]) # gets the 3rd element
#output
#10
#20
#30
๐7๐1
Jiske pass Laptop nhi hai ๐
Mobile best Compiler's
C Compiler Click Here
C++ Compiler Click Here
Python Compiler Click Here
Java Compiler Click Here
Sql Compiler Click Here
Universal Compilers for mobile
Replit (web or app) Click Here
Jdoodle(web or app) Click Here
Programize (web) Search web
For any help Freely Say here
Mobile best Compiler's
C Compiler Click Here
C++ Compiler Click Here
Python Compiler Click Here
Java Compiler Click Here
Sql Compiler Click Here
Universal Compilers for mobile
Replit (web or app) Click Here
Jdoodle(web or app) Click Here
Programize (web) Search web
For any help Freely Say here
๐2
Learn how to create Telegram Bot
Also clear Javascript basics
(Regular video Uploading...)
https://youtube.com/playlist?list=PLjEYzWkdEvxvar65MToPfkA1x4CeZ_bNk
Also clear Javascript basics
(Regular video Uploading...)
https://youtube.com/playlist?list=PLjEYzWkdEvxvar65MToPfkA1x4CeZ_bNk
YouTube
Node js telegram bot from mobile
node js telegram bot from mobile by ignou study center - Siddharth sharma
Now you can compile your codes by @CodeCompiler_bot
Come in @IO_Coding or @bca_group_pro for Compilation of your code
Come in @IO_Coding or @bca_group_pro for Compilation of your code
"""
Pattern:
* * * *
* * *
* *
*
*
* *
* * *
* * * *
"""
n = int(input("Enter no.: "))
for i in range(1, n):
print(" " * i , "* " * (n-i))
for i in range(1, n):
print(" " * (n - i ), "* " * i)
# @Python_Codes_Pro
Pattern:
* * * *
* * *
* *
*
*
* *
* * *
* * * *
"""
n = int(input("Enter no.: "))
for i in range(1, n):
print(" " * i , "* " * (n-i))
for i in range(1, n):
print(" " * (n - i ), "* " * i)
# @Python_Codes_Pro
๐11
Common techniques for using the set() function in Python:
1. Create a set from a list:
1. Create a set from a list:
my_list = [1, 2, 2, 3, 3, 3]
my_set = set(my_list)
2.Add an item to a set:my_set = {1, 2, 3}
my_set.add(4)
3.Remove an item from a set by its value:my_set = {1, 2, 3}
my_set.remove(3)
4.Check if an item is in a set:my_set = {1, 2, 3}
if 3 in my_set:
print("The item is in the set.")
5.Get the length of a set:my_set = {1, 2, 3}
set_length = len(my_set)
6.Loop through the items in a set:my_set = {1, 2, 3}
for item in my_set:
print(item)
7.Get the union of two sets:set1 = {1, 2, 3}
set2 = {3, 4, 5}
union_set = set1.union(set2)
8.Get the intersection of two sets:set1 = {1, 2, 3}
set2 = {3, 4, 5}
intersection_set = set1.intersection(set2)
// @python_codes_pro๐4โค1
Some function of list
fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
#gives_count_of_apples
fruits.count('apple')
2
fruits.count('tangerine')
0
#to_get_index_of_banana
fruits.index('banana')
3
#Find_next_banana_starting_a_position_4
fruits.index('banana', 4)
6
#to_reverse_fruits_list
fruits.reverse()
fruits
['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']
#to_add_item_at_the_end_of_the_list
fruits.append('grape')
fruits
['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']
#sort_the_fruits_list
fruits.sort()
fruits
['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']
#to_delete_the_last_item_in_the_list
fruits.pop()
'pear'
// @python_codes_pro
fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
#gives_count_of_apples
fruits.count('apple')
2
fruits.count('tangerine')
0
#to_get_index_of_banana
fruits.index('banana')
3
#Find_next_banana_starting_a_position_4
fruits.index('banana', 4)
6
#to_reverse_fruits_list
fruits.reverse()
fruits
['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']
#to_add_item_at_the_end_of_the_list
fruits.append('grape')
fruits
['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']
#sort_the_fruits_list
fruits.sort()
fruits
['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']
#to_delete_the_last_item_in_the_list
fruits.pop()
'pear'
// @python_codes_pro
โค1
Python Codes Basic to Advance pinned ยซAll Codes @C_Code5 @CPP_Coding @Python_Codes_Pro @Java_Codes_Pro @jsCode0 Discussion @bca_mca_btechยป
You know which languages ?
Anonymous Poll
38%
Hindi/urdu written in [English]
68%
English
17%
Tamil/telugu/Malayalam/marathi etc
1%
Chinese
4%
Others
๐2๐1
If you want any bot which will run codes in your group you can freely use @CodeCompiler_Bot
๐๐๐๐ keep studying....
๐๐๐๐ keep studying....
set1 = {1, 2, 3}
set2 = {3, 4, 5}
union_set = set1.union(set2)
print(union_set)
set2 = {3, 4, 5}
union_set = set1.union(set2)
print(union_set)