www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need help for my python codes

  1. #1
    Join Date
    Jan 2014
    Location
    Pakistan
    Posts
    15

    Need help for my python codes

    Hi) I am having some problems in my python codes so please help me out in producing the desired outputs from those code lines.
    Code 1
    Write a program that uses raw_input to prompt a user for their name and then welcomes them. Note that raw_input will pop a dialog box. Enter Sarah in the pop-up box when you are prompted so your output will match the desired output below.

    name = raw_input('Enter your name')
    print 'Welcome'.name
    Desired Output
    Hello Sarah

    [B]Code 2[B]
    Write a program to prompt the user for hours and rate per hour using raw_input to compute gross pay. Use 35 hours and a rate of 2.75 per hour to test the program (the pay should be 96.25). You should use raw_input to read a string and float() to convert the string to a number. Do not worry about error checking or bad user data.
    # This first line is provided for you

    hrs = raw_input("Enter Hours:")
    Desired Output
    96.25

    Thanks)

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,361
    Hint: Do you know what the multiplication operator is in Python (and most other programming languages, for that matter)?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles