Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jul 30, 2021
1 parent 18c7cea commit 0f840ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions basics/answers.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ isn't exactly like mine but it works just fine it's ok, and you can
3. In the code below, `palindrome_input[::-1]` is the string `palindrome_input` reversed.
For example, if `palindrome_input` is `"hello"`, then `palindrome_input[::-1]` is `"olleh"`.
```python
palindrome_input=input("Type the number to check:")
palindrome_input = input("Enter a string: ")
if palindrome_input == palindrome_input[::-1]:
print("This string is a palindrome")
else:
Expand Down Expand Up @@ -326,10 +326,10 @@ isn't exactly like mine but it works just fine it's ok, and you can
6. ```python
row_count=int(input("Type the number of rows needed:"))
for line_number in range(1, row_count + 1):
for number in range(line_number, row_count+1):
print(number, end=' ')
print()
for line_number in range(1, row_count+1):
for number in range(line_number, row_count+1):
print(number, end=' ')
print()
```
Just like in the previous exercise, if the user enters 5, the first `for` loop gives the line numbers `1, 2, 3, 4, 5`.<br>
For example, on line 2, we should print numbers from 2 to 5, as in `range(2, 6)`, or in general, `range(line_number, row_count+1)`.
Expand Down
2 changes: 1 addition & 1 deletion basics/handy-stuff-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ ValueError: could not convert string to float: 'hello'
print(message, "!!!")
print(message, "!!!")
```
3. Make a program to take the input from the user and check if it is a palindrome.<br>
3. Make a program to ask a string from the user and check if it is a palindrome.<br>
(Hint: A string is a palindrome if it is the same when reversed. Google how to reverse a string.)

The answers are [here](answers.md#handy-stuff-strings).
Expand Down

0 comments on commit 0f840ff

Please sign in to comment.