10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f73c47 commit 1735099Copy full SHA for 1735099
session_10/answers/A5.py
@@ -1,3 +1,17 @@
1
-# 5. Write a class which has two methods get_word and print_word.
2
-# - get_word accepts a string from the user and print_word prints the string in upper case.
+# 5. Create a class called Upper which has two methods called get_word and print_word.
+# - the get_word method should accept a string from the user
3
+# - the print_word method prints the string in upper case.
4
5
+class Upper:
6
+ def __init__(self):
7
+ self.word = ""
8
+
9
+ def get_word(self):
10
+ self.word = input("Input a word:\n")
11
12
+ def print_word(self):
13
+ print(self.word.upper())
14
15
+word1 = Upper()
16
+word1.get_word()
17
+word1.print_word()
0 commit comments