Can anyone help me code a simple python code?

Joined
Mar 13, 2022
Messages
1
Reaction score
0
Hey guys, i hope you are all doing alright!

I have a college assigment due Wednesday, and i really dont understand it, i would really apprieciate it if someone helped me.

I cannot pay im really sorry, but im happy to run an errand for you or help you do something.

https://www.toptal.com/developers/hastebin/enazolifor.coffeescript

You can find my assignment up there ^^, or in the spoiler down below

Develop a program in Python that:

1.At the beginning of the program on the console appears "agent in call ....."
2. Receives input from the user asking them to write a certain text.
3. Print the text from the user to the console.
4. Find the length of the text using the ready-made method and print on the console the length of the text showing that the length of the text is: the length of the text.
5. Print on the console the text which starts from index 7 to the end of the text.
6. Print the first and last character of the text given by the user, in the console should appear: The first letter in your text is (Print the letter) and the last letter in the given text is: (print the letter).

7. At the end of the program you must print "Close".
 
Joined
Mar 15, 2022
Messages
1
Reaction score
1
```
print("agent in call....")
user_input = input("Type input: ")
print("%s" % user_input)
print("the length of the text is: %d" % len(user_input))
print("%s" % user_input[7:])
print("The first letter in your text is %s and the last letter in the given text is %s" % (user_input[0], user_input[-1]))
print("Close")
```

This is the code. the first line is simple print, the second line is a simple input prompt. In the fourth line, the method len(user_input) returns the number of elements in the iterable user_input. In the fifth line, we "slice" the string user_input, by putting a colon after 7(the element we want to slice the string from) in the index operator. In the sixth line, we put -1 in the index operator to get the last element of string user_input.

For any further clarification, you can refer to the following questions from stackoverflow:

Feel free to ask anything.
P.S. - this is the very basics. don't pay anyone to teach you this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,808
Messages
2,569,684
Members
45,443
Latest member
sol

Latest Threads

Top