Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 14, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 14, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 14, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 14, 2025

      I test a lot of AI coding tools, and this stunning new OpenAI release just saved me days of work

      May 14, 2025

      How to use your Android phone as a webcam when your laptop’s default won’t cut it

      May 14, 2025

      The 5 most customizable Linux desktop environments – when you want it your way

      May 14, 2025

      Gen AI use at work saps our motivation even as it boosts productivity, new research shows

      May 14, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025
      Recent

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025

      Perficient’s “What If? So What?” Podcast Wins Gold at the 2025 Hermes Creative Awards

      May 14, 2025

      PIM for Azure Resources

      May 14, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025
      Recent

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025

      You can now share an app/browser window with Copilot Vision to help you with different tasks

      May 14, 2025

      Microsoft will gradually retire SharePoint Alerts over the next two years

      May 14, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Best of…: Classic WTF: Python Charmer

    Best of…: Classic WTF: Python Charmer

    July 10, 2024

    When comparing your language to a snake*, be careful to not get bitten. (*Yes, I know, the name of the language is a reference to Monty Python, not snakes). Original. —Remy

    “I don’t have a whole lot of experience in Python,” writes Jakob, “in fact, when I was hired, the only thing I knew about the language was that whitespace was important.”

    “Fortunately — actually, unfortunately — it doesn’t take a whole lot of experience in Python to recognize that my company’s codebase is… well… sub-optimal. Submitted for your approval is a method used to generate a password, found in our network security library.”

    def genpassword(wlc,maxchar,txt,List,verbose):
    word = “”
    i1 = i2 = i3 = i4 = i5 = i6 = i6 = i7 = i8 = i9 = i10 = i11 = i12 = i13 = i14 = i15 = 0
    txtfile = open(txt,’w’)

    i = 0
    mc = int(maxchar) – 1
    lword = [0]
    for i in range(mc):
    lword += [0]

    for i1 in range(len(wlc)):
    for i2 in range(len(wlc)):
    for i3 in range(len(wlc)):
    for i4 in range(len(wlc)):
    for i5 in range(len(wlc)):
    for i6 in range(len(wlc)):
    for i7 in range(len(wlc)):
    for i8 in range(len(wlc)):
    for i9 in range(len(wlc)):
    for i10 in range(len(wlc)):
    for i11 in range(len(wlc)):
    for i12 in range(len(wlc)):
    for i13 in range(len(wlc)):
    for i14 in range(len(wlc)):
    for i15 in range(len(wlc)):
    if int(maxchar) == 1 :
    word = wlc[i15]
    if int(maxchar) == 2 :
    word = wlc[i14] + wlc[i15]
    if int(maxchar) == 3 :
    word = wlc[i13] + wlc[i14] + wlc[i15]
    if int(maxchar) == 4 :
    word = wlc[i12] + wlc[i13] + wlc[i14] + wlc[i15]
    if int(maxchar) == 5 :
    word = wlc[i11] + wlc[i12] + wlc[i13] + wlc[i14]
    + wlc[i15]
    if int(maxchar) == 6 :
    word = wlc[i10] + wlc[i11] + wlc[i12] + wlc[i13]
    + wlc[i14] + wlc[i15]
    if int(maxchar) == 7 :
    word = wlc[i9] + wlc[i10] + wlc[i11] + wlc[i12]
    + wlc[i13] + wlc[i14] + wlc[i15]
    if int(maxchar) == 8 :
    word = wlc[i8] + wlc[i9] + wlc[i10] + wlc[i11]
    + wlc[i12] + wlc[i13] + wlc[i14] + wlc[i15]
    if int(maxchar) == 9 :
    word = wlc[i7] + wlc[i8] + wlc[i9] + wlc[i10]
    + wlc[i11] + wlc[i12] + wlc[i13] + wlc[i14] + wlc[i15]
    if int(maxchar) == 10 :
    word = wlc[i6] + wlc[i7] + wlc[i8] + wlc[i9]
    + wlc[i10] + wlc[i11] + wlc[i12] + wlc[i13] + wlc[i14]
    + wlc[i15]
    if int(maxchar) == 11 :
    word = wlc[i5] + wlc[i6] + wlc[i7] + wlc[i8]
    + wlc[i9] + wlc[i10] + wlc[i11] + wlc[i12] + wlc[i13]
    + wlc[i14] + wlc[i15]
    if int(maxchar) == 12 :
    word = wlc[i4] + wlc[i5] + wlc[i6] + wlc[i7] + wlc[i8]
    + wlc[i9] + wlc[i10] + wlc[i11] + wlc[i12] + wlc[i13]
    + wlc[i14] + wlc[i15]
    if int(maxchar) == 13 :
    word = wlc[i3] + wlc[i4] + wlc[i5] + wlc[i6]
    + wlc[i7] + wlc[i8] + wlc[i9] + wlc[i10]
    + wlc[i11] + wlc[i12] + wlc[i13]
    + wlc[i14] + wlc[i15]
    if int(maxchar) == 14 :
    word = wlc[i2] +wlc[i3] + wlc[i4] + wlc[i5] + wlc[i6]
    + wlc[i7] + wlc[i8] + wlc[i9] + wlc[i10]
    + wlc[i11] + wlc[i12] + wlc[i13]
    + wlc[i14] + wlc[i15]
    if int(maxchar) == 15 :
    word = wlc[i1] + wlc[i2] + wlc[i3] + wlc[i4]
    + wlc[i5] + wlc[i6] + wlc[i7] + wlc[i8] + wlc[i9]
    + wlc[i10] + wlc[i11] + wlc[i12] + wlc[i13]
    + wlc[i14] + wlc[i15]

    if int(verbose) == 1:
    print word

    txtfile.writelines(word + “n”)

    i = 0
    end = 0
    if int(List) == 1 :
    for i in range(len(word)):
    lword[i] = “9”
    if str(lword) == str(list(word)):
    end = 1
    elif (int(List) == 2):
    for i in range(len(word)):
    lword[i] = “z”
    if str(lword) == str(list(word)):
    end = 1
    elif (int(List) == 3):
    for i in range(len(word)):
    lword[i] = “Z”
    if str(lword) == str(list(word)):
    end = 1
    elif (int(List) == 4):
    for i in range(len(word)):
    lword[i] = “z”
    if str(lword) == str(list(word)):
    end = 1
    elif (int(List) == 5):
    for i in range(len(word)):
    lword[i] = “Z”
    if str(lword) == str(list(word)):
    end = 1
    elif (int(List) == 6):
    for i in range(len(word)):
    lword[i] = “Z”
    if str(lword) == str(list(word)):
    end = 1

    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break
    if end == 1 : break

    txtfile.close()

    Jakob continues, “I can only hope this language doesn’t have a goto statement…”

    [Advertisement]
    BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleIcelandic Frumtak Ventures closes fourth fund at $87M
    Next Article Getting “org.openqa.selenium.UnsupportedCommandException: This API is not supported anymore ” This error while running my test case

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 15, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-47785 – Emlog SQL Injection and Remote Code Execution

    May 15, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Bluesky saw a 763% rise in users in 2024, including 13 million new users in just the past month and a half

    Development

    CVE-2025-4247 – SourceCodester Simple To-Do List System SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Plank Reloaded: Desktop Dock App for Cinnamon

    Linux

    U.S. Navy Punishes Senior Enlisted Leader for Operating Wi-Fi Network On Ship

    Development

    Highlights

    Development

    Contextual SDG Research Identification: An AI Evaluation Agent Methodology

    December 3, 2024

    Universities face intense global competition in the contemporary academic landscape, with institutional rankings increasingly tied…

    U.S. Court Slashes $78M Lawyers’ Fee in T-Mobile Data Breach Settlement

    July 30, 2024

    NVIDIA AI Introduces NVILA: A Family of Open Visual Language Models VLMs Designed to Optimize both Efficiency and Accuracy

    December 7, 2024

    CVE-2025-4143 – Cloudflare Workers-OAuth-Provider OAuth Redirect URI Validation Bypass

    May 1, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.