1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dolphi86 [110]
4 years ago
8

I need help with Python. The first image is the code and the 2nd is the output.

Computers and Technology
1 answer:
Gekata [30.6K]4 years ago
4 0
The issue arises because the string you are trying to print is not a string, rather a float value. Item1, item2 and item3 are strong values (if you type some alphabets in it and not just numbers), but itemonecost, itemtwocost, and itemthreecost are explicitly type casted to float. In line 22, 23, and 24 you’re trying to print a float, by adding it with the string. One cannot add numbers to string. Rather you can type cast the itemcost to string while printing.

Add str(itemonecost) instead of itemonecost in print statement. Do this for other float variables too.

However do note that there are multiple ways to correct this issue, and I’ve just pointed one out.
You might be interested in
Hye I'm new branily I don't no use in this aap please follow me​
mixas84 [53]
Um ok? I think u have to have more points to be able to follow people tho
8 0
3 years ago
The study and practice of information storage and retrieval is called
puteri [66]
Information Science
4 0
3 years ago
Write a program which asks the user to enter N numbers. The program will print out their average. Try your program with the foll
Likurg_2 [28]

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

int n;

double average,sum=0,x;

cout<<"enter the Value of N:";

// read the value of N

cin>>n;

cout<<"enter "<<n<<" Numbers:";

// read n Numbers

for(int a=0;a<n;a++)

{

   cin>>x;

   // calculate total sum of all numbers

   sum=sum+x;

}

// calculate average

average=sum/n;

// print average

cout<<"average of "<<n<<" Numbers is: "<<average<<endl;

return 0;

}

Explanation:

Read the total number from user i.e "n".Then read "n" numbers from user with for loop and sum them all.Find there average by dividing the sum with n.And print the average.

Output:

enter the Value of N:5

enter 5 Numbers:20.5 19.7 21.3 18.6 22.1

average of 5 Numbers is: 20.44

7 0
4 years ago
Shape: element::paintbrush: ..............
kondor19780726 [428]
There is no question here but it might be paint
6 0
4 years ago
Only people who have nitrotype answer this question!!!
grigory [225]

Answer:

Krampus 4k Nitrotype team- VVIXEN

3 0
3 years ago
Read 2 more answers
Other questions:
  • If a user’s current directory is /home/mary/project1, which command could she use to move to the etc directory directly under th
    5·1 answer
  • Five indicators of computer illiteracy​
    13·1 answer
  • You receive a file named Project4.xlsx as an attachment to an email message. What do you expect the file to contain?
    8·1 answer
  • Why should you log out when you finish an online session?
    9·1 answer
  • What is the value of the variable named result after the following code executes? var X = 5; var Y = 3; var Z = 2; var result =
    14·1 answer
  • If number is 20, what is printed to the console after this code is executed?
    13·1 answer
  • ______ includes websites that encourage interaction and connection among people, businesses, and organizations.
    6·1 answer
  • What type of computer system can be found in the computer lab at school?
    14·1 answer
  • PLEASE HELP WILLL GIVE BRAINLIESTTTTT!
    13·2 answers
  • Class ____________ allow you to create one version of a class, without having to replicate code to handle multiple data types.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!