Answered step by step
Verified Expert Solution
Question
1 Approved Answer
mystery _ string = Lucy #You may modify the lines of code above, but don't move them! #When you Submit your code, we'll change these
mysterystring "Lucy"
#You may modify the lines of code above, but don't move them!
#When you Submit your code, we'll change these lines to
#assign different values to the variables.
#There's an easy way to do this exercise, and a hard way. For
#a hint on the easier way, revisit the sample answers for the
#previous coding exercise.
#
#Above we've created a variable called mysterystring. Write
#some code that will print the first letter of the string on
#the first line, the first two letters on the second line,
#the first three letters on the third line, etc., until it
#prints the entire string on the last line.
#
#For example, if the string was "Lucy", then the output would
#be:
#
#L
#Lu
#Luc
#Lucy
#
#Hint: to print without automatically starting a new line,
#include the text end inside the print statement's
#parentheses. For example, printHello end will print
#the word "Hello" without starting a new line afterward. So
#calling it twice would print "HelloHello" on one line
#instead of two lines.
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