Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7752113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:43:00+00:00 2026-06-01T11:43:00+00:00

I made a program: import collections x = input(Enter in text: ) x_counter =

  • 0

I made a program:

import collections
x = input("Enter in text: ")
x_counter = collections.Counter()
x_counter.update(x)
print("Your sequence contains:\n")
for i in '`1234567890-=qwertyuiop[]\asdfghjkl;zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP\
{}|ASDFGHJKL:"ZXCVBNM<>?':
    print(i, x_counter[i])

That prints out the number of times a letter has been used in a text.
When the user enters in a smaller sized text, like a paragraph for example…the program runs fine. When the user enters a very long text, say 5 paragraphs…the program quits and runs all of the input as bash commands…Why is this???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:43:01+00:00Added an answer on June 1, 2026 at 11:43 am

    That’s because input only gets a single line from the user, as per the following example:

    pax> cat qq.py
    x = raw_input ("blah: ") # using raw_input for Python 2
    print x
    
    pax> python qq.py
    blah: hello<ENTER>
    hello
    
    pax> there<ENTER>
    bash: there: command not found
    
    pax> 
    

    One possibility is to read the information from a file rather than using input, but you can also do something like:

    def getline():
        try:
            x = raw_input ("Enter text (or eof): ")
        except EOFError:
            return ""
        return x + "\n"
    
    text = ""
    line = getline()
    while line != "":
        text = text + line;
        line = getline()
    print "\n===\n" + text
    

    which will continue to read input from the user until they end the input with EOF (CTRL-D under Linux):

    pax> python qq.py
    Enter text (or eof): Hello there,
    Enter text (or eof): 
    Enter text (or eof): my name is Pax.
    Enter text (or eof): <CTRL-D>
    ===
    Hello there,
    
    my name is Pax.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made simple python program to generate big text file: import sys import random
i had made a program for text to speech convertion in python..and now want
I have made an object named Skill and the main program. Skill : import
Made a program retrieving .txt files from a folder. Each .txt files contains 1
I have made a program that gets some strings in input from the user
I made a program. I also made my own file type, which the program
I made small program to divide large pictures and take part of them. When
I made a program that opens an application, sleeps the thread for 500ms then
I made a program which i want to launch with some protocal for eg
I made this program for a school, and it involves a telnet server. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.