Question

PYTHON 1- Write a function that receives a string value as a parameter, converts its first...

PYTHON

1- Write a function that receives a string value as a parameter, converts its first character to uppercase and returns the first character.

2- Test your function by writing a main, which calls your function and prints its return value.

3- Save your program in a file called firstChar.py and use the following link to submit your file.  

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def firstChar(s):
    s = s[0].upper() + s[1:]
    return s[0]

def main():
    s = "test"
    print(firstChar(s))

main()

T

Add a comment
Know the answer?
Add Answer to:
PYTHON 1- Write a function that receives a string value as a parameter, converts its first...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PYTHON 1- Write a program that creates a dictionary of the English words for all single...

    PYTHON 1- Write a program that creates a dictionary of the English words for all single digit numbers as follows: 1: 'one', 2: 'two', 3: 'three', etc. 2- Write a function called numConvert that receives the above dictionary and an integer number as parameters, and prints the English words for all the number's digits. For example, if the function receives 2311, it will print: two three one one 3- Test your program by adding a main function, which calls numConvert....

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

  • Create a Python script file called hw.py. Then import the module random: from random import *...

    Create a Python script file called hw.py. Then import the module random: from random import * Thanks in advance! Ex. 1. Write a function called cleanLowerWord that receives a string as a paramcter and retums a new string that is a copy of the parameter where all the lowercase letters are kept as such, uppercase letters are converted to lowercase, and everything else is deleted. For example, the function call cleanLowerWord("Hello, User 15!") should return the string "hellouser". For this,...

  • 1- Write a program that creates a dictionary of the English words for all single digit...

    1- Write a program that creates a dictionary of the English words for all single digit numbers as follows: 1: 'one', 2: 'two', 3: 'three', etc. 2- Write a function called numConvert that receives the above dictionary and an integer number as parameters, and prints the English words for all the number's digits. For example, if the function receives 2311, it will print: two three one one 3- Test your program by adding a main function, which calls numConvert. 4-...

  • Code written in NASM Function called findLargest Write a function called findLargest that receives two parameters:...

    Code written in NASM Function called findLargest Write a function called findLargest that receives two parameters: an unsigned doubleword array and the length of the array. The function must return the value of the largest array member in eax. Preserve all registers (except eax) that are modified by the function. Write a test program in main that calls findLargest three times, each call using a different array with different lengths. Function called countHits Write a function called named countHits that...

  • PYTHON 3.6 (Short and Simple Codes Please) Write a recursive function, reverse, that accepts a parameter...

    PYTHON 3.6 (Short and Simple Codes Please) Write a recursive function, reverse, that accepts a parameter containing a string value and returns the original string in reverse. For example, calling reverse('goodbye') would return 'eybdoog'. Reversing a string involves: No action if the string is empty or only has 1 character Concatenating the last character with the result of reversing the string consisting of the second through next-to-last character, followed by the first character

  • 10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string...

    10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...

  • 2. Overload a function "display" so that (a) if display is called with a string, it...

    2. Overload a function "display" so that (a) if display is called with a string, it prints the string 5 times and then returns the length of the string (b) if it is called with an integer, n, it prints n, 2n, 3n and has no return value (c) if it is called with a character, it prints the character on the first line, 2 of the character on the 2nd line, 3 of it on the 3rd line and...

  • Please write this code in python programming and provide a screen short of the code. Reading:...

    Please write this code in python programming and provide a screen short of the code. Reading: P4E 7; Tut 7.2, 7.2.1 Upload an original Python script that satisfies the following criteria: It has at least two functions Function 1: This function has one parameter, a string containing the path to an existing text file that will be read by your function Using a with statement, the function opens the file indicated by the parameter for reading The function counts the...

  • Using python, Write a function max3 that takes three numbers as its arguments and returns the...

    Using python, Write a function max3 that takes three numbers as its arguments and returns the greatest of these three numbers. Your submitted file for this problem should include (a) function definition, obviously, and (b) the code that calls that function (for this problem you do not have to package that calling code into the main() function although you may if you want to), so that if I run your *.py file it computes and prints something (e.g. few test...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT