Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Initialize a variable c with ’b’ (python 3)
New Posts  All Forums:Forum Nav:

Initialize a variable c with ’b’ (python 3)

post #1 of 2
Thread Starter 
I have an assignment about which I am pretty confused.

Quote:
Write a program which:
1. intializes a variable a with 123, and prints the value of a over 7 places
2. intializes a variable b with -89.6548754, and prints the value of b over 10 places and with a floating point precision of 4
3. initializes a variable c with ’b’, and prints the character on the screen

I got the first two, which are as follows

The first one:
Code:
a = 123
print("The value is {0:7d}".format(a))

The second one is:
Code:
b=-89.6548754
print("The value is {:10.4f}".format(b))
But does the third one mean? My problem is the English of the question. Is the one below what the assignment question is about?
Code:
c='b'
print(c)
post #2 of 2
Quote:
Originally Posted by Heater Master View Post

I have an assignment about which I am pretty confused.
I got the first two, which are as follows

The first one:
Code:
a = 123
print("The value is {0:7d}".format(a))

The second one is:
Code:
b=-89.6548754
print("The value is {:10.4f}".format(b))
But does the third one mean? My problem is the English of the question. Is the one below what the assignment question is about?
Code:
c='b'
print(c)

Seems like your answer satisfies the question.
Cube
(9 items)
 
  
CPUMotherboardRAMHard Drive
i7-4930k EVGA X79 Dark Corsair Vengeance Pro Samsung 840 Pro 
CoolingMonitorPowerCase
Corsair H100i Viewsonic VP2770 EVGA SuperNova 1000P2 Corsair Air 540 
Mouse
Corsair M65 
  hide details  
Reply
Cube
(9 items)
 
  
CPUMotherboardRAMHard Drive
i7-4930k EVGA X79 Dark Corsair Vengeance Pro Samsung 840 Pro 
CoolingMonitorPowerCase
Corsair H100i Viewsonic VP2770 EVGA SuperNova 1000P2 Corsair Air 540 
Mouse
Corsair M65 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Initialize a variable c with ’b’ (python 3)