Forwarded from Python Projects
#PracticeCode: 0048
🎯 FORWARD IF YOU LIKE IT 🎯
Task:
You have to create a program to create a dictionary. Take input of an integer (from 1 to n) and print the dictionary in (a , a**2) format.
Sample :-
Input - 4
Output - { 1 : 1 , 2 : 4 , 3 : 9 , 4 : 16}
GOOD LUCK!
««« Discuss your solution @python_programmers_club and proper solutions will be added to our Github page »»»
««« Click here for the Solution »»»
🔥Ready to take this challenge? 🔥
#python #PracticeCode #samples #interviewQuestions #conditions #dict
🎯 FORWARD IF YOU LIKE IT 🎯
Task:
You have to create a program to create a dictionary. Take input of an integer (from 1 to n) and print the dictionary in (a , a**2) format.
Sample :-
Input - 4
Output - { 1 : 1 , 2 : 4 , 3 : 9 , 4 : 16}
GOOD LUCK!
««« Discuss your solution @python_programmers_club and proper solutions will be added to our Github page »»»
««« Click here for the Solution »»»
🔥Ready to take this challenge? 🔥
#python #PracticeCode #samples #interviewQuestions #conditions #dict
# Python Code to copy to Windows Clipboard
Code#python #CodeSamples
import win32clipboard
# set clipboard data
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText('testing 123')
win32clipboard.CloseClipboard()
# get clipboard data
win32clipboard.OpenClipboard()
data = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
print data
Check if the file is empty or not
#python #CodeSamples
import os
file_path = 'mysample.txt'
# check if size of file is 0
if os.stat(file_path).st_size == 0:
print('File is empty')
else:
print('File is not empty')
#python #CodeSamples
The while Loop
#python #CodeSamples
while <expr>:
<statement(s)>
<break> #will take you out of the loop
<statements>
<continue>
<statements>
<statements> #break will bring you here
Example:
x = 10
while x > 0:
x -= 1
if x == 5:
break
if x == 8:
continue #Don't print when its 8
print(x)
print("outside loop")
#python #CodeSamples
Class accepting List as argument in init()
#python #CodeSamples
class myclass:
def __init__(self, mylst = []):
print(mylst)
names = ["hello", "python", "devs", "iGnani"]
myclass(names)
#python #CodeSamples
Connecting to Amazon Redshift database and Inserting data
#python #sampleCode #amazon #redshift
import psycopg2
con=psycopg2.connect(dbname= 'dbname', host='host', port= 'port', user= 'user', password= 'pwd')
#once the above code executes and connection is established
# create a cursor
cur = con.cursor()
#now you can execute select statements
cur.execute("SELECT * FROM employee;")
#Next you need to instruct Psycopg how to fetch your data
cur.fetchall()
#Finally, don't forget to close your cursor & connection
cur.close()
conn.close()
#python #sampleCode #amazon #redshift
»»» Interactive Tools and Lessons «««
👉🏻 Computer Science Circles
👉🏻 How to Think Like a Computer Scientist, Interactive Edition
👉🏻 Interactive tutorials for scientific programming using Python
👉🏻 Problem Solving with Algorithms and Data Structures using Python
👉🏻 Thonny, Python IDE for begginners
#tools #lessons #python
👉🏻 Computer Science Circles
👉🏻 How to Think Like a Computer Scientist, Interactive Edition
👉🏻 Interactive tutorials for scientific programming using Python
👉🏻 Problem Solving with Algorithms and Data Structures using Python
👉🏻 Thonny, Python IDE for begginners
#tools #lessons #python
Python Data Science Handbook - Binder Colab
This repository contains the entire Python Data Science Handbook, in the form of (free!) Jupyter notebooks.
#python #ebook #jupyter #notebook
This repository contains the entire Python Data Science Handbook, in the form of (free!) Jupyter notebooks.
#python #ebook #jupyter #notebook
O’Reilly Online Learning
Python Data Science Handbook
For many researchers, Python is a first-class tool mainly because of its libraries for storing, manipulating, and gaining insight from data. Several resources exist for individual... - Selection from Python Data Science Handbook [Book]
Web Scraping Tutorials
👉🏻 Intro To Web Scraping With Python
👉🏻 Intro to Web Scraping with Python and Beautiful Soup
👉🏻 Beautiful Soup Tutorial - Web Scraping in Python
👉🏻 Web Scraping With Python - Edureka
👉🏻 Web Scraping With Python using Beautiful Soup & Requests
#python #tutorial #webScraping #BeautifulSoup
👉🏻 Intro To Web Scraping With Python
👉🏻 Intro to Web Scraping with Python and Beautiful Soup
👉🏻 Beautiful Soup Tutorial - Web Scraping in Python
👉🏻 Web Scraping With Python - Edureka
👉🏻 Web Scraping With Python using Beautiful Soup & Requests
#python #tutorial #webScraping #BeautifulSoup
YouTube
Intro To Web Scraping With Python
In this video we will look at web scraping using Python and the BeautifulSoup library. This is an introductory level tutorial. All beginners welcome
Final Code Gist:
https://gist.github.com/bradtraversy/f2014a236646ff62dccfc9fe5d469ed5
💖 Become a Patron:…
Final Code Gist:
https://gist.github.com/bradtraversy/f2014a236646ff62dccfc9fe5d469ed5
💖 Become a Patron:…
Even More Python for Beginners: Data Tools by Microsoft
https://www.youtube.com/playlist?list=PLlrxD0HtieHhHnCUVtR8UHS7eLl33zfJ-
#course #python #beginners
Aspiring data-science and machine-learning developers now have more Microsoft-made free video tutorials to learn how to build software in Python, one of today's most popular and versatile programming languages.
The new More Python for Beginners series consists of 20 videos that run between two minutes and 15 minutes each. It covers working with files, lambdas or 'anonymous functions', and object-oriented programming, and each tutorial is followed by a short demo video. The tutors also introduce some newer functionality to support asynchronous development through async/await.
https://www.youtube.com/playlist?list=PLlrxD0HtieHhHnCUVtR8UHS7eLl33zfJ-
#course #python #beginners