Mekire wrote:Just write something showing you can figure out how to loop over the string. Post it. You'll get no more help until you do. Every time you post back we want to see what you have tried. If you haven't tried anything new then we are wasting time trying to help you.
I don't know what loop over string means!!!
this is some stuff i was given, looping over characters.
Time to combine some of our skills. We want to use our understanding of strings, the len function and while loops to print out each character of a string, one per line.
To do this, we can create an index variable, i and loop from 0 up to (but not including) the length of the string, which we can find using len(s):
- Code: Select all
word = 'lock'
i = 0
while i < len(word):
i = i + 1
but i don't even get what that means and i don't know how to loop over a string, and how to loop over a string to help me in my question..
i am really stuck.
i don't know much python:
all i know is: -
Print a string
Recognise a syntax error
Store things in variables
Read input from the user
Use mathematical operations (+ - * / **)
Find the length of a string
Convert between numbers and strings
Print out numbers and strings
Use the if/elif/else control structure
Understand the difference between assignment and comparison
Make numerical comparisons using (> < = != >= <=)
Use nested if statements
Check for substrings within a string
Use strings in conditional expressions in if statements
Change the case of a string
Replacing parts of a string
Loop over the characters in a string
Loop over a range of numbers
Printing output from a loop on one line
Sum numbers using a loop
Understand the difference between floats and integers
Convert between floats and integers
Use slicing to extract a substring from a string
String methods: startswith, endswith, strip
Looping while something is true: while loops
Using counters to step in loops
Reading multiple lines from the user
Looping over characters
Factorisation: worked example
Access and modify elements in a list
Sort and reverse a list
Create a list to store multiple values
Loop while a condition is true
Use while loops to loop over a range of numbers
Identify an infinite loop
Use a while loop to read input from the user