1 383
订阅者
无数据24 小时
-27 天
-830 天
帖子存档
1 383
Must 📍Watch 15+ Movies For Programmer👨💻❤️
1. The Internship
2. The Social Network
3. Source Code
4. The Imitation Game
5. Silicon Valley
6. Mr. Robot
7. Jobs
8. The Founder
9. The Social Dilemma
10. The Great Hack
11. Halt and Catch fire
12. Wargames
13. Halt and Catch fire
14. Hackers
15. Snowden
16. Who Am I
17. The Matrix
Do not forget to React to this Message for More Content Like this
👇
Thanks For Joining All💙
1 383
Happy Independent Day
import turtle
from turtle import *
# setting the screen for drawing
scr = turtle.Screen()
# Defining the instance of turtle
ttl = turtle.Turtle()
speed(500)
# keeping the pen up initially
ttl.penup()
ttl.goto(-150, 125)
ttl.pendown(
)
# Drawing the Orange Rectangle first
#and then the white rectangle
ttl.color("orange")
ttl.begin_fill()
ttl.forward(400)
ttl.right(90)
ttl.forward(84)
ttl.right(90)
ttl.forward(400)
ttl.end_fill()
ttl.left(90)
ttl.forward(84)
# now drawing the Green Rectangle
ttl.color("green")
ttl.begin_fill()
ttl.forward(84)
ttl.left(90)
ttl.forward(400)
ttl.left(90)
ttl.forward(84)
ttl.end_fill()
# Drawing the central Big Blue Circle
ttl.penup()
ttl.goto(35, 0)
ttl.pendown()
ttl.color("navy")
ttl.begin_fill()
ttl.circle(35)
ttl.end_fill()
# Drawing the in-circle Big White Circle
ttl.penup()
ttl.goto(30, 0)
ttl.pendown()
ttl.color("white")
ttl.begin_fill()
ttl.circle(30)
ttl.end_fill()
#Drawing the inside Mini Blue Circles of Flag
ttl.penup()
ttl.goto(-27, -4)
ttl.pendown()
ttl.color("navy")
for j in range(24):
ttl.begin_fill()
ttl.circle(2)
ttl.end_fill()
ttl.penup()
ttl.forward(7)
ttl.right(15)
ttl.pendown()
# drawing the Smaller Blue Circle
ttl.color("navy")
ttl.penup()
ttl.goto(10, 0)
ttl.pendown()
ttl.begin_fill()
ttl.circle(10)
ttl.end_fill()
#Drawing the 24 spokes of the Indian Flag
ttl.penup()
ttl.goto(0, 0)
ttl.pendown()
ttl.pensize(1)
for j in range(24):
ttl.forward(30)
ttl.backward(30)
ttl.left(15)
#Drawing the stick of the Indian flag
ttl.color("Brown")
ttl.pensize(10)
ttl.penup()
ttl.goto(-150,125)
ttl.right(180)
ttl.pendown()
ttl.forward(500)
#to hide the turtle pen we used hideturtle
ttl.hideturtle()
#holding the output on the window
turtle.done()1 383
Here is the Python program to print a butterfly pattern:
n = 5 # number of rows
# upper half of the butterfly
for i in range(n):
print("*" * (i + 1) + " " * (2 * (n - i - 1)) + "*" * (i + 1))
# lower half of the butterfly
for i in range(n - 2, -1, -1):
print("*" * (i + 1) + " " * (2 * (n - i - 1)) + "*" * (i + 1))
This will output:
* * ** ** *** *** **** **** *** *** ** ** * *
1 383
Here are five pattern programs in Python:
Pattern 1: Star Pattern
n = 5
for i in range(n):
print("*" * (i+1))
Output:
* ** *** **** *****Pattern 2: Number Pattern
n = 5
for i in range(1, n+1):
for j in range(1, i+1):
print(j, end=" ")
print()
Output:
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5Pattern 3: Pyramid Pattern
n = 5
for i in range(n):
print(" " * (n-i-1) + "*" * (2*i+1))
Output:
* *** ***** ******* *********Pattern 4: Diamond Pattern
n = 5
for i in range(n):
print(" " * (n-i-1) + "*" * (2*i+1))
for i in range(n-2, -1, -1):
print(" " * (n-i-1) + "*" * (2*i+1))
Output:
*
***
*****
*******
*********
*******
*****
***
*
Pattern 5: Alphabet Pattern
n = 5
for i in range(n):
for j in range(i+1):
print(chr(65+j), end=" ")
print()
Output:
A A B A B C A B C D A B C D ENote: In the Alphabet Pattern,
chr(65+j) is used to print the alphabet characters, where 65 is the ASCII value of 'A'.1 383
Here's a roadmap to help you learn Python:
Phase 1: Setting Up and Basics (1-2 weeks)
1. Install Python: Download and install the latest version of Python from the official website.
2. Choose an IDE: Install a Python Integrated Development Environment (IDE) like PyCharm, Visual Studio Code, or Spyder.
3. Basic Syntax: Learn basic syntax, data types, operators, control structures, functions, and modules.
4. Variables: Understand variable assignment, data types, and operations.
5. Data Structures: Learn about lists, tuples, dictionaries, sets, and arrays.
Phase 2: Python Fundamentals (2-3 weeks)
1. File Input/Output: Learn how to read and write files, and understand the concept of buffering.
2. Exception Handling: Understand how to catch and handle exceptions in Python.
3. Object-Oriented Programming: Learn about classes, objects, inheritance, polymorphism, and encapsulation.
4. Module Exploration: Explore built-in modules like math, statistics, and datetime.
5. Common Libraries: Learn about common libraries like
requests, Beautiful Soup, Tkinter, and Pandas.
Phase 3: Practical Applications (2-3 weeks)
1. Web Scraping: Learn how to scrape data from web pages using requests and Beautiful Soup.
2. Automation: Automate tasks using Python scripts.
3. Data Analysis: Learn basic data analysis using Pandas and Matplotlib.
4. Machine Learning: Explore basic machine learning concepts using Scikit-Learn.
5. Projects: Apply your knowledge by working on practical projects.
Phase 4: Advanced Topics (2-3 weeks)
1. Decorators: Learn about decorators and how to use them.
2. Generators: Understand how to create and use generators.
3. Asyncio: Learn about asynchronous programming using Asyncio.
4. Flask or Django: Explore web development frameworks like Flask or Django.
5. Testing: Learn about unit testing and integration testing using Pytest.
Phase 5: Mastery and Specialization (3-6 months)
1. Focus on a specific area: Choose a specific area like data science, machine learning, web development, or automation.
2. Read others' code: Study open-source projects and learn from others' code.
3. Practice, practice, practice: Practice coding challenges, and participate in coding competitions.
4. Read books and tutorials: Continuously learn by reading books, tutorials, and online courses.
5. Join online communities: Participate in online communities like Reddit's r/learnpython, r/Python, and Stack Overflow.
Additional Tips
1. Be consistent: Set aside dedicated time to learn and practice.
2. Start small: Break down complex topics into smaller, manageable chunks.
3. Ask for help: Join online communities or find a mentor to help you with questions.
4. Code reviews: Get feedback on your code from others to improve your skills.
5. Review and revise: Regularly review and revise your understanding of each topic.
Remember, learning Python takes time and practice. Stay committed, and you'll become proficient in Python in no time!