About Me
I studied Linguistics at State University of Campinas (UNICAMP/Brazil) and have held roles in Technology, Education, and Media research. I've always been passionate about computational systems adequate for modeling various aspects of language (syntax, semantics, pragmatics). I'm interested in connecting with other people who want to discuss about the topics that affect their professional success, world education, technologies and happiness.
-- Carolina Bonturi
Classes
|
Class status: Under Construction
Role:
Student
|
.
0% complete
|
|
Class status: Established
Role:
Student
|
.
0% complete
|
|
Class status: Established
Role:
Student
|
.
5% complete
|
Submitted Assignments
 |
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 1, HW 1
Wiki Exercises
-
Write a program that asks the user to type in a string, and then tells the user how long that string was.
-
Ask the user for a string, and then for a number.
Print out that string, that many times.
(For example, if the string is hello and the number is 3 you should print out hellohellohello.)
-
What would happen if a mischievous user typed in a word when you ask for a number? Try it.
>>> print ("write something interesting about you routine")
write something interesting about you routine
>>> print ("write something interesting about you routine")
write something interesting about you routine
>>> response = raw_input()
To com fome, quero leite
>>> print (len(response))
24
--------------------------
>>> print ('Please, write your favorite number')
Please, write your favorite number
>>> resp1 = raw_input()
23
>>> number = int(resp1)
>>> print (number)
23
>>> print ('Now, write your favorite colour')
Now, write your favorite colour
>>> resp2 = raw_input()
purple
>>> color = str(resp2)
>>> print (color * number)
purplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurplepurple
------------------------------
>>> print ('Enter with a number')
Enter with a number
>>> response = raw_input ()
12
>>> response = int(response)
>>> print type(response)
<type 'int'>
>>> response = raw_input()
bla
>>> response = int(response)
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
response = int(response)
ValueError: invalid literal for int() with base 10: 'bla'
>>> print type(response)
<type 'str'>
cbonturi
1 year ago
|
|