Hey everyone, I have some code here that I just wrote for a course I am taking
in computer science. The instructions are, "Given the variables s and t defined as
s = udacity; t = bodacious; Write python code that prints out 'udcaious' without
using any quote characters in your code.
My Code:
Note: This isn't actual homework, as I am still a student in school. I'm about to get my
high school diploma and I'm just studying up on computer science before I take it in college
next year. Im giving a good 4+ hours a day into studying computer science just to have a
headstart before next year.
## Solved ##
Realized I had to use the slice notation, in the above post I had ' "" ' inside
of my variables which wasn't allowed.
in computer science. The instructions are, "Given the variables s and t defined as
s = udacity; t = bodacious; Write python code that prints out 'udcaious' without
using any quote characters in your code.
My Code:
1 2 3 4 5 6 7 |
s = 'udacity' t = 'bodacious' grab_u = s.find( 'u' ) grab_dacious = t.find( 'dacious' ) the_answer = s[grab_u] + t[grab_dacious:] print (the_answer) |
high school diploma and I'm just studying up on computer science before I take it in college
next year. Im giving a good 4+ hours a day into studying computer science just to have a
headstart before next year.
## Solved ##
Realized I had to use the slice notation, in the above post I had ' "" ' inside
of my variables which wasn't allowed.
1 2 3 4 |
s = 'udacity' t = 'bodacious' print (s[ 0 ] + t[ 2 :]) |