Python Forum
How will you improve my code?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How will you improve my code?
#2
(Jul-17-2019, 02:35 PM)Gateux Wrote: 1. Accept inputs in both upper and lower case
- I can't figure how to do this, as right now my code only accept upper case e.g "Y

The string method lower can be used to make the comparison always be between lower case strings.

users_input = 'Y'
if users_input.lower() == 'y':
    print('user input Yes')
Output:
user input Yes
Note: there is also a upper string method if the code was to compare upper strings.
Reply


Messages In This Thread
How will you improve my code? - by Gateux - Jul-17-2019, 02:35 PM
RE: How will you improve my code? - by Yoriz - Jul-17-2019, 06:24 PM
RE: How will you improve my code? - by metulburr - Jul-17-2019, 06:26 PM
RE: How will you improve my code? - by Yoriz - Jul-17-2019, 06:50 PM
RE: How will you improve my code? - by ndc85430 - Jul-20-2019, 12:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I improve string similarity in my current code? SUGSKY 3 2,378 May-28-2020, 05:16 AM
Last Post: deanhystad
  Improve this code (Receipt alike) Leonzxd 10 7,931 Jun-26-2018, 03:33 PM
Last Post: Leonzxd

Forum Jump:

User Panel Messages

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