Write, save, and run a Python program Ask the user to enter a number of grams....

50.1K

Verified Solution

Question

Programming

Write, save, and run a Python program

  1. Ask the user to enter a number of grams. Your program convertsthat to whole tones, then whole kilograms and whatever is left isin grams. It prints the entered grams , tones , kilograms and theremaining grams.

     4 marks

for i in range(0,10):
print(i)

2    what is wrong inthe above python code?

display your explanation using printstatement.

  1. mark

3    insert thefollowing comments into your program of part
      (1). make sure the comment spans 3lines of your code.

This program converts,

the number of seconds you haveentered

into whole hours, then the wholeminutes and whatever..

     2 mark

mark = mark1+ mark2+

           mark3 + mark4

4   what is wrong in theabove python code?

display your explanation using printstatement.

  1. mark

5 The output of the program shouldlook similar to the output of a sample run shown below.

      2 marks

10 marks total

#Sample run

Enter the weight in grams: 217123935

Total 217123 tones is 217 tones, 123 kilograms, 935 grams.

(you provide your answer for task 3)

This program converts,

the number of seconds you have entered

into whole hours, then the whole minutes and whatever..

(you provide your answer for task 4)

Process finished with exit code 0

This code should display the above answer

Answer & Explanation Solved by verified expert
3.8 Ratings (725 Votes)
Python codeAnswer to Q1This Program Converts given amount in grams to tones kilos and gramsval intinputEnter the weight in grams printTotal d is d tones d kilograms d grams val intval1000000 intval10001000000    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students