Question

i want a code about a weather forecast in python, based on the country they select...

i want a code about a weather forecast in python, based on the country they select . simple, easy and short code that has the following requirements:

1- one user input of any type of( string/float/int)
2- i need two function of any type( void/ value returning) “ one of the functions should have one parameter at least” .
3- one list
4- two list operation
5- one string operation
6- one short mathematical operation

quickly please!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The required code is given below in case of any doubts you can ask me in comments.

main.py

def extendList(lis1):
lisExtended = ["Hello"]
lisExtended.extend(lis1)
return lisExtended

def printList(lis):
for x in lis:
print(x)

def total_length(lis):
length = 0
for x in lis:
length += len(x)
return length

def main():
num = input("Enter a String : ")
length = len(num)
lis = []
for x in range(1,length):
lis.append(num[:x])
printList(lis)
print("Total length of all things in List : ",total_length(lis))
printList(extendList(lis))
  
main()
  

Screenshot

- Online Python Compiler - online x + 6 # Language Python 3 - G Paused 6 : Save {} Beautify onlinegdb.com/online_python_compi

Output

- Online Python Compiler - online x + - 0 x 6 Paused onlinegdb.com/online_python_compiler Run Debug Stop e Share ☆ S G Langua

Add a comment
Know the answer?
Add Answer to:
i want a code about a weather forecast in python, based on the country they select...
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
  • can anyone show me how this code would look in python, I'm studying python while taking...

    can anyone show me how this code would look in python, I'm studying python while taking some classes. I can't seem to understand what this is asking for. • Phase 1 Requirements Code submitted for Phase 1 will only have the following capability. Any additional coding will result in the loss of point. • code will have the main function, including looping until the user enters input of 12 • code will call the printMenu() function • The printMenu() function...

  • Can someone help me with my code.. I cant get an output. It says I do...

    Can someone help me with my code.. I cant get an output. It says I do not have a main method. HELP PLEASE. The instruction are in bold on the bottom of the code. package SteppingStones; //Denisse.Carbo import java.util.Scanner; import java.util.ArrayList; import java.util.List; public class SteppingStone5_Recipe { private String recipeName; private int servings; private List<String> recipeIngredients; private double totalRecipeCalories; public String getRecipeName() { return recipeName; } public void setRecipeName (string recipeName){ this.recipeName = recipeName; } public int getServings() { return...

  • How to do this code? HW13.11. Create an HTML list from a Python list The function...

    How to do this code? HW13.11. Create an HTML list from a Python list The function below takes one parameter: a list, that contains only strings. Complete the function to create a unordered HTML list, as a string, and returns it. An empty list should return an empty HTML list with no list items. Do not add any extraneous whitespace to the HTML. For example, if given the list ["one", "two"], the function should return "<ul><li>one</li><li>two</li> </ul>". student.py IT TI...

  • Please help. I need a very simple code. For a CS 1 class. Write a program...

    Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...

  • Below is the code for the class shoppingList, I need to enhance it to accomplish the...

    Below is the code for the class shoppingList, I need to enhance it to accomplish the challenge level as stated in the description above. public class ShoppingList {   private java.util.Scanner scan; private String[] list; private int counter; public ShoppingList() { scan = new java.util.Scanner(System.in); list = new String[10]; counter = 0; } public boolean checkDuplicate(String item) { for(int i = 0; i < counter; i++) { if (list[i].equals(item)) return true; } return false; } public void printList() { System.out.println("Your shopping...

  • In this assignment you will be implementing a weather forecaster. It involves writing 3 different classes...

    In this assignment you will be implementing a weather forecaster. It involves writing 3 different classes plus a driver program. It is recommended that you write one class at a time and then write a driver (tester) program to ensure that it works before putting everything together. Alternately, you can use the Interactions tab of JGRASP to test some of the early classes. This is discussed in the next few pages. The Season Class The first, shortest, and easiest class...

  • I want to change this code and need help. I want the code to not use...

    I want to change this code and need help. I want the code to not use parallel arrays, but instead use one array of struct containing the data elements, String for first name, String for last name,Array of integers for five (5) test scores, Character for grade. If you have any idea help would be great. #include #include #include #include using namespace std; const int NUMBER_OF_ROWS = 10; //number of students const int NUMBER_OF_COLUMNS = 5; //number of scores void...

  • I wrote this code but there’s an issue with it : #include <iostream> #include <vector&...

    I wrote this code but there’s an issue with it : #include <iostream> #include <vector> #include <string> #include <fstream> using namespace std; class Borrower { private: string ID, name; public: Borrower() :ID("0"), name("no name yet") {} void setID(string nID); void setName(string nID); string getID(); string getName(); }; void Borrower::setID(string nID) { ID = nID; } void Borrower::setName(string nname) { name = nname; } string Borrower::getID() { return ID; } string Borrower::getName() { return name; } class Book { private: string...

  • I need to code that statement in python. The Bold is code we were given and...

    I need to code that statement in python. The Bold is code we were given and the italics are the statements we need to code. oa- ← > C q p t crant ps bb er nauedubbc vebda pid 26210 4-dtcc entid 57221440 1 co ses 1177 NAU00-ISM 320-SECOC2-3961 NAL PSSS Li u Lat6F17see2%281%29 df ::: Apcs welcome Spencer- NFLPl2ers b Cole 訂: YouTube Red-3:es gr Rac-12com Feeds ma Oreon2018 Basce ma Oreocn20'8 Footb2 1 Gobal Gamo wth Cther toocmais...

  • I’m giving you code for a Class called GenericArray, which is an array that takes a...

    I’m giving you code for a Class called GenericArray, which is an array that takes a generic object type. As usual this is a C# program, make a new console application, and for now you can stick all of this in one big file. And a program that will do some basic stuff with it Generic Array List What I want you to do today: Create methods for the GenericArray, Easy(ish): public void Append (T, value) { // this should...

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