This program does not run because all three variable names break a naming rule. Press Run to see the error. Rename the variables to first_name, home_city and grade, and update the print() lines to match. Keep the values the same. …
A student gets a scholarship if their average is at least 85 and they missed fewer than 5 days. Create good_marks and good_attendance using comparisons. Create eligible that is True only when both are true (use and). Print the three …
Given age = 20: Create is_adult that is True when age is 18 or more. Use a comparison — do not just type True. Print is_adult. Print bool(0). Print bool(“hello”). Expected output: True False True
Prices arrived as text: coffee = “15.5” and cake = “22”. Create total as a float (the sum of both prices). Create whole — the total as an int (decimals cut off). Create receipt = “Total: 37.5 Nakfa” built with …
Two prices arrived as text: a = “10” and b = “5”. Create total, the number sum of a and b (it should be 15). Create message = “Total: ” joined with total. Print total, then message. Expected output: 15 …
Abel scored 78, 85, 90 and 71 in four exams. Create total — the sum of the four marks. Create average — the total divided by 4, rounded to 1 decimal place. Print total, then average. Expected output: 324 81.0
Create three variables: x = 7 (int) y = 2.5 (float) z = 3j (complex) Print the type of each one, in that order. Then print x + y. Expected output: <class ‘int’> <class ‘float’> <class ‘complex’> 9.5
Five variables are given. Without changing them, print the name of the type of each one, one per line, using type(x).__name__. Expected output: str int float bool str Notice the last one: why is “3.5” a str?
Create these four variables: name — a string with your name age — an integer height — a float, for example 1.75 is_student — a boolean Then print the type of height. The output must be: <class ‘float’>
This program crashes because two lines contain mistakes. Do not fix or delete them — comment out the two broken lines so that the rest of the program runs and prints: Start Price: 45 End
