Python Forum
Print the longest str from user input
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print the longest str from user input
#1
Essentially, the user inputs random strings and i am trying to reprint the longest string that the user input (so far it only prints the first non-capital letter). A bit lost on how to fix this.

loopEnd = ""

n = (input("Input: "))
longString = max(n)

while n != loopEnd:
    n = str(input("Input: "))
    if n == loopEnd:
        print("Longest input was", "'",longString,"'")
Reply


Messages In This Thread
Print the longest str from user input - by edwdas - Nov-04-2019, 09:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Simulate an answer based on user input [Beginner needs guidance] Bombardini 1 1,290 Nov-12-2022, 03:47 AM
Last Post: deanhystad
Sad Find Longest streak for habits johnconar 3 1,869 Sep-12-2022, 07:13 PM
Last Post: deanhystad
Bug How to print only vowels from an input? PP9044 8 7,566 Feb-26-2021, 04:02 PM
Last Post: Serafim
  Print user input into triangle djtjhokie 1 2,385 Nov-07-2020, 07:01 PM
Last Post: buran
  Changing Directory based on user input paulmerton4pope 13 8,059 Aug-14-2020, 11:48 AM
Last Post: GOTO10
  how to add the user input from file into list wilson20 8 4,337 May-03-2020, 10:52 PM
Last Post: Larz60+
  How to print the docstring(documentation string) of the input function ? Kishore_Bill 1 3,554 Feb-27-2020, 09:22 AM
Last Post: buran
  Writing a function that changes its answer based on user input SirRavenclaw 2 2,818 Dec-21-2019, 09:46 PM
Last Post: Clunk_Head
  how to add user input to a dictionary to a graph KINGLEBRON 3 3,044 Jul-31-2019, 09:09 PM
Last Post: SheeppOSU
  New to Python - tiny coding assistance on user input function and assign to variable Mountain_Duck 1 2,519 Mar-23-2019, 06:54 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020