A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

for computer science can someone help me with the first problem set

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    more specifically assigning the input of the users name to a variable

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah. See to assign anything to a variable we follow the following syntax: Variable_name=Value for example: firstName='Ben' Now here value (name) is not prior known to us, what we want to do is ask the user to input the name so that we can store it or assign it to the a variable. To input something from user we follow the following syntax: raw_input('Some text to display') for example: raw_input('Whats ur first name: ') this will print the text and wait for user to input thru keyboard. now since we want to store the input, we do the following: firstName=raw_input('Whats ur first name: ') now to print the firstName we simply do the follwing: print firstName hope this was helpful.

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Assigning basically has the form: myVariable = someExpression Where myVariable is the name of the variable you want to assign, and someExpression is an expression which will yield a value. In this case the expression you will use is a call to the function raw_input that will prompt the user for a string of text and return that text.

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.