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
#6
As stated - this is only Python 3.8 compatible code (using walrus operator).

Task can be described: 'collect user input until break and find longest input'

So


# assign empty list to a name where user input will be collected

# while True loop - executes until 'break' encountered in the body of loop
# assign name to user input
# check if user input is break symbol or word, if so - break loop
# append answer to list of collected inputs

# print max value by length in list
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Simulate an answer based on user input [Beginner needs guidance] Bombardini 1 1,314 Nov-12-2022, 03:47 AM
Last Post: deanhystad
Sad Find Longest streak for habits johnconar 3 1,923 Sep-12-2022, 07:13 PM
Last Post: deanhystad
Bug How to print only vowels from an input? PP9044 8 7,619 Feb-26-2021, 04:02 PM
Last Post: Serafim
  Print user input into triangle djtjhokie 1 2,419 Nov-07-2020, 07:01 PM
Last Post: buran
  Changing Directory based on user input paulmerton4pope 13 8,151 Aug-14-2020, 11:48 AM
Last Post: GOTO10
  how to add the user input from file into list wilson20 8 4,358 May-03-2020, 10:52 PM
Last Post: Larz60+
  How to print the docstring(documentation string) of the input function ? Kishore_Bill 1 3,581 Feb-27-2020, 09:22 AM
Last Post: buran
  Writing a function that changes its answer based on user input SirRavenclaw 2 2,845 Dec-21-2019, 09:46 PM
Last Post: Clunk_Head
  how to add user input to a dictionary to a graph KINGLEBRON 3 3,074 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,538 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