티스토리 뷰

Comparators

3 < 4 5 >= 5 10 == 10 12 != 13

Boolean operators

True or False (3 < 4) and (5 >= 5) this() and not that()

Conditional statements

if this_might_be_true(): print "This really is true." elif that_might_be_true(): print "That is true." else: print "None of the above."


# Complete the if and elif statements! def grade_converter(grade): if grade >= 90: return "A" elif grade >= 80 : return "B" elif grade >= 70: return "C" elif grade >= 65: return "D" else: return "F" # This should print an "A" print grade_converter(92) # This should print a "C" print grade_converter(70) # This should print an "F" print grade_converter(61)


pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
  word = original.lower()
  first = word[0]
  new_word = word[1:len(word)] + first + pyg
  print new_word
else:
  print 'empty'

'IT > Python: Codecademy' 카테고리의 다른 글

6 Student Becomes the Teacher  (0) 2018.02.24
5 Lists & Dictionaries  (0) 2018.02.22
Python 4 Functions  (0) 2018.02.21
Python 2 Strings and Console Output  (0) 2018.02.18
Python: 1 Python Syntax  (0) 2018.02.18
댓글
Announcement
Recent Posts
Recent Comments
Total
Today
Yesterday
Link
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Search by month