Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In python Evaluate and write code that extracts substrings from strings using indexing, slicing, and string library methods explained in the book to evaluate and
In python Evaluate and write code that extracts substrings from strings using indexing, slicing, and string library methods explained in the book to evaluate and to write code that uses conditional statements. In yarnoneplease myt note which #d conditional structure you'd use and why-how it is unique to fit this problem? Second, please write code using it. Write a program that reads in input from the user. The user will type their favorite foreign country. If the letter 'e' exists in this input, print the number of times that the letter 'e' occurs. If it doesn't, print an appropriate message ALONG WITH the oniginal string itself. -Hint: Which of the above 6 conditional structures would you use? Might you need a keyword too? Write a program that reads in input from the user. The input should be the year that the student was bom. Keep the input as a string. Now, slice that string into 4 characters each stored in their own variable. Treating those digits as numbers first check to make sure that the student wasn't bom in the 2000s. If they were, print "Aren't you too young to be in college?" Otherwise, if the student was bom during or before the year 1980, print "Where were you on Y2K?" If the student was bon after 1980 but before 1990, print "What are liquor stores like?" If the last digit in the student's year of birth is less than 6, print "You're close to Reid's age Othewise, print the oiginal input string What rahge must the last digit be in given the above logic
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started