Little questions derive from PygLatin


#1

I'm a beginner for learning programming.
And there're 4 questions bothering me now:

1.
first question in this lesson is why should we put:

## word=original.lower()
## first=word[0]

into the if statement
is it improper to put them at the header?

2.

## 1. new_word = word[1:len(word)]
## 2. new_word = word[1: ]

these two, are there any difference in cases?

3.
is it okay to redefine the variable like below?

## s = input()
## s = s.upper()

4.
is it possible to create a variable called"new word" instead of "new_word"?

Thanks for all of your reply in advance.!!!
I do appreciate to read any response from python learners around the world.


#2
  1. When the user input is invalid, why do further operations on the user input? It waste resources. That is why we put .lower() inside the if statement. Its just to make the program logic and efficient.

  2. No difference

  3. Its okay, but you could also consider:

    s = input().upper()
    1. No, variable names can't have spaces in them


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.