Skip to content

Commit 715bd80

Browse files
author
meshmote
committed
Fixed raw input conversion to types
1 parent 388ebf6 commit 715bd80

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
basket = ["Apples", "Pears", "Oranges", "Paches"]
22
print basket
3-
new_fruit = raw_input('Type in the name of another fruit')
4-
basket.append(new_fruit)
3+
new_fruit = raw_input('Type in the name of another fruit-->')
4+
fruit = str(new_fruit)
5+
basket.append(fruit)
56
print basket
6-
fruit_index = raw_input("Type in the fruit index")
7-
print fruit_index +': ' + basket[fruit_index-1]
8-
new_fruit = raw_input("Type in the name of another fruit")
9-
basket = new_fruit + basket
7+
fruit_index = raw_input("Type in the fruit index-->")
8+
index = int(fruit_index)
9+
print fruit_index +': ' + basket[index-1]
10+
new_fruit = raw_input("Type in the name of another fruit-->")
11+
fruit = str(new_fruit)
12+
basket = fruit + basket
1013
print basket

0 commit comments

Comments
 (0)